{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**<div style=\"text-align: center\"><font color='#dc2624' face='微软雅黑' size = \"6\">线性回归与时间特征</font></div>**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.core.interactiveshell import InteractiveShell\n",
    "InteractiveShell.ast_node_interactivity = \"all\" # 代码块显示所有执行结果"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**<div style=\"text-align: left\"><font color='black' face='微软雅黑' size = \"6\">引言</font><a name='top'></a></div>**\n",
    "\n",
    "* 首先进行数据清洗，查看航班数据集的特征。\n",
    "* 绘制实践序列图形，EDA，以查看模式。\n",
    "* 先线性回归，通过分析残差分布，来寻找隐藏的影响因素。\n",
    "* 通过分段建模，进一步降低残差。\n",
    "* 通过鲁棒回归，降低离群值的影响。\n",
    "* 总之，最终通过分段建模和鲁棒回归，将残差降到最低，得到1个优秀的模型，并在此过程中分析影响每天航班数量的因素。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "toc": true
   },
   "source": [
    "<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
    "<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#需要的包\" data-toc-modified-id=\"需要的包-1\"><span class=\"toc-item-num\">1&nbsp;&nbsp;</span>需要的包</a></span></li><li><span><a href=\"#数据集\" data-toc-modified-id=\"数据集-2\"><span class=\"toc-item-num\">2&nbsp;&nbsp;</span>数据集</a></span></li><li><span><a href=\"#EDA\" data-toc-modified-id=\"EDA-3\"><span class=\"toc-item-num\">3&nbsp;&nbsp;</span>EDA</a></span></li><li><span><a href=\"#回归\" data-toc-modified-id=\"回归-4\"><span class=\"toc-item-num\">4&nbsp;&nbsp;</span>回归</a></span></li><li><span><a href=\"#残差分析\" data-toc-modified-id=\"残差分析-5\"><span class=\"toc-item-num\">5&nbsp;&nbsp;</span>残差分析</a></span></li><li><span><a href=\"#分箱\" data-toc-modified-id=\"分箱-6\"><span class=\"toc-item-num\">6&nbsp;&nbsp;</span>分箱</a></span></li><li><span><a href=\"#分段回归\" data-toc-modified-id=\"分段回归-7\"><span class=\"toc-item-num\">7&nbsp;&nbsp;</span>分段回归</a></span></li><li><span><a href=\"#鲁棒回归\" data-toc-modified-id=\"鲁棒回归-8\"><span class=\"toc-item-num\">8&nbsp;&nbsp;</span>鲁棒回归</a></span></li><li><span><a href=\"#总体趋势\" data-toc-modified-id=\"总体趋势-9\"><span class=\"toc-item-num\">9&nbsp;&nbsp;</span>总体趋势</a></span></li></ul></div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 需要的包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "            <div id=\"vkCJKP\"></div>\n",
       "            <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
       "                if(!window.letsPlotCallQueue) {\n",
       "                    window.letsPlotCallQueue = [];\n",
       "                }; \n",
       "                window.letsPlotCall = function(f) {\n",
       "                    window.letsPlotCallQueue.push(f);\n",
       "                };\n",
       "                (function() {\n",
       "                    var script = document.createElement(\"script\");\n",
       "                    script.type = \"text/javascript\";\n",
       "                    script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v2.2.0/js-package/distr/lets-plot.min.js\";\n",
       "                    script.onload = function() {\n",
       "                        window.letsPlotCall = function(f) {f();};\n",
       "                        window.letsPlotCallQueue.forEach(function(f) {f();});\n",
       "                        window.letsPlotCallQueue = [];\n",
       "                        \n",
       "                    };\n",
       "                    script.onerror = function(event) {\n",
       "                        window.letsPlotCall = function(f) {};    // noop\n",
       "                        window.letsPlotCallQueue = [];\n",
       "                        var div = document.createElement(\"div\");\n",
       "                        div.style.color = 'darkred';\n",
       "                        div.textContent = 'Error loading Lets-Plot JS';\n",
       "                        document.getElementById(\"vkCJKP\").appendChild(div);\n",
       "                    };\n",
       "                    var e = document.getElementById(\"vkCJKP\");\n",
       "                    e.appendChild(script);\n",
       "                })()\n",
       "            </script>\n",
       "            "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 数据处理\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "# 绘图\n",
    "from pyecharts import options as opts\n",
    "# from pyecharts.charts import Bar\n",
    "from pyecharts.charts import Line\n",
    "# from pyecharts.charts import Pie\n",
    "from pyecharts.globals import ThemeType\n",
    "from lets_plot import LetsPlot, ggplot, aes, geom_boxplot, geom_line, geom_point, geom_hline, geom_smooth\n",
    "from lets_plot import scale_x_datetime, scale_color_brewer, facet_wrap, ggsize\n",
    "LetsPlot.setup_html() # 默认开启JS交互模式\n",
    "# LetsPlot.setup_html(no_js=True) # 关闭JS交互模式\n",
    "\n",
    "# 建模\n",
    "import statsmodels.formula.api as smf"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据集\n",
    "航班数据集, 来自R\n",
    "```R\n",
    "library(nycflights13)\n",
    "str(flights)\n",
    "flights2 = flights\n",
    "flights2$time_hour = strftime(flights2$time_hour, format='%Y-%m-%d %H:%M:%S')\n",
    "write.csv(flights2, file='./flights.csv', na='NA', row.names = F)\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(336776, 19)"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>year</th>\n",
       "      <th>month</th>\n",
       "      <th>day</th>\n",
       "      <th>dep_time</th>\n",
       "      <th>sched_dep_time</th>\n",
       "      <th>dep_delay</th>\n",
       "      <th>arr_time</th>\n",
       "      <th>sched_arr_time</th>\n",
       "      <th>arr_delay</th>\n",
       "      <th>carrier</th>\n",
       "      <th>flight</th>\n",
       "      <th>tailnum</th>\n",
       "      <th>origin</th>\n",
       "      <th>dest</th>\n",
       "      <th>air_time</th>\n",
       "      <th>distance</th>\n",
       "      <th>hour</th>\n",
       "      <th>minute</th>\n",
       "      <th>time_hour</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2013</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>517.0</td>\n",
       "      <td>515</td>\n",
       "      <td>2.0</td>\n",
       "      <td>830.0</td>\n",
       "      <td>819</td>\n",
       "      <td>11.0</td>\n",
       "      <td>UA</td>\n",
       "      <td>1545</td>\n",
       "      <td>N14228</td>\n",
       "      <td>EWR</td>\n",
       "      <td>IAH</td>\n",
       "      <td>227.0</td>\n",
       "      <td>1400</td>\n",
       "      <td>5</td>\n",
       "      <td>15</td>\n",
       "      <td>2013-01-01 18:00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2013</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>533.0</td>\n",
       "      <td>529</td>\n",
       "      <td>4.0</td>\n",
       "      <td>850.0</td>\n",
       "      <td>830</td>\n",
       "      <td>20.0</td>\n",
       "      <td>UA</td>\n",
       "      <td>1714</td>\n",
       "      <td>N24211</td>\n",
       "      <td>LGA</td>\n",
       "      <td>IAH</td>\n",
       "      <td>227.0</td>\n",
       "      <td>1416</td>\n",
       "      <td>5</td>\n",
       "      <td>29</td>\n",
       "      <td>2013-01-01 18:00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2013</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>542.0</td>\n",
       "      <td>540</td>\n",
       "      <td>2.0</td>\n",
       "      <td>923.0</td>\n",
       "      <td>850</td>\n",
       "      <td>33.0</td>\n",
       "      <td>AA</td>\n",
       "      <td>1141</td>\n",
       "      <td>N619AA</td>\n",
       "      <td>JFK</td>\n",
       "      <td>MIA</td>\n",
       "      <td>160.0</td>\n",
       "      <td>1089</td>\n",
       "      <td>5</td>\n",
       "      <td>40</td>\n",
       "      <td>2013-01-01 18:00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2013</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>544.0</td>\n",
       "      <td>545</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>1004.0</td>\n",
       "      <td>1022</td>\n",
       "      <td>-18.0</td>\n",
       "      <td>B6</td>\n",
       "      <td>725</td>\n",
       "      <td>N804JB</td>\n",
       "      <td>JFK</td>\n",
       "      <td>BQN</td>\n",
       "      <td>183.0</td>\n",
       "      <td>1576</td>\n",
       "      <td>5</td>\n",
       "      <td>45</td>\n",
       "      <td>2013-01-01 18:00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2013</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>554.0</td>\n",
       "      <td>600</td>\n",
       "      <td>-6.0</td>\n",
       "      <td>812.0</td>\n",
       "      <td>837</td>\n",
       "      <td>-25.0</td>\n",
       "      <td>DL</td>\n",
       "      <td>461</td>\n",
       "      <td>N668DN</td>\n",
       "      <td>LGA</td>\n",
       "      <td>ATL</td>\n",
       "      <td>116.0</td>\n",
       "      <td>762</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-01 19:00:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   year  month  day  dep_time  sched_dep_time  dep_delay  arr_time  \\\n",
       "0  2013      1    1     517.0             515        2.0     830.0   \n",
       "1  2013      1    1     533.0             529        4.0     850.0   \n",
       "2  2013      1    1     542.0             540        2.0     923.0   \n",
       "3  2013      1    1     544.0             545       -1.0    1004.0   \n",
       "4  2013      1    1     554.0             600       -6.0     812.0   \n",
       "\n",
       "   sched_arr_time  arr_delay carrier  flight tailnum origin dest  air_time  \\\n",
       "0             819       11.0      UA    1545  N14228    EWR  IAH     227.0   \n",
       "1             830       20.0      UA    1714  N24211    LGA  IAH     227.0   \n",
       "2             850       33.0      AA    1141  N619AA    JFK  MIA     160.0   \n",
       "3            1022      -18.0      B6     725  N804JB    JFK  BQN     183.0   \n",
       "4             837      -25.0      DL     461  N668DN    LGA  ATL     116.0   \n",
       "\n",
       "   distance  hour  minute           time_hour  \n",
       "0      1400     5      15 2013-01-01 18:00:00  \n",
       "1      1416     5      29 2013-01-01 18:00:00  \n",
       "2      1089     5      40 2013-01-01 18:00:00  \n",
       "3      1576     5      45 2013-01-01 18:00:00  \n",
       "4       762     6       0 2013-01-01 19:00:00  "
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "year                       int64\n",
       "month                      int64\n",
       "day                        int64\n",
       "dep_time                 float64\n",
       "sched_dep_time             int64\n",
       "dep_delay                float64\n",
       "arr_time                 float64\n",
       "sched_arr_time             int64\n",
       "arr_delay                float64\n",
       "carrier                   object\n",
       "flight                     int64\n",
       "tailnum                   object\n",
       "origin                    object\n",
       "dest                      object\n",
       "air_time                 float64\n",
       "distance                   int64\n",
       "hour                       int64\n",
       "minute                     int64\n",
       "time_hour         datetime64[ns]\n",
       "dtype: object"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "flights_df1 = pd.read_csv('./flights.csv', parse_dates=['time_hour'])\n",
    "flights_df1.shape # 33万行\n",
    "flights_df1.head()\n",
    "flights_df1.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "year              False\n",
       "month             False\n",
       "day               False\n",
       "dep_time           True\n",
       "sched_dep_time    False\n",
       "dep_delay          True\n",
       "arr_time           True\n",
       "sched_arr_time    False\n",
       "arr_delay          True\n",
       "carrier           False\n",
       "flight            False\n",
       "tailnum            True\n",
       "origin            False\n",
       "dest              False\n",
       "air_time           True\n",
       "distance          False\n",
       "hour              False\n",
       "minute            False\n",
       "time_hour         False\n",
       "dtype: bool"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>colname</th>\n",
       "      <th>na_count</th>\n",
       "      <th>perct</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>year</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>month</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>day</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dep_time</td>\n",
       "      <td>8255</td>\n",
       "      <td>2.451184</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>sched_dep_time</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dep_delay</td>\n",
       "      <td>8255</td>\n",
       "      <td>2.451184</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>arr_time</td>\n",
       "      <td>8713</td>\n",
       "      <td>2.587180</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>sched_arr_time</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>arr_delay</td>\n",
       "      <td>9430</td>\n",
       "      <td>2.800081</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>carrier</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>flight</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>tailnum</td>\n",
       "      <td>2512</td>\n",
       "      <td>0.745896</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>origin</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dest</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>air_time</td>\n",
       "      <td>9430</td>\n",
       "      <td>2.800081</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>distance</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>hour</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>minute</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>time_hour</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           colname  na_count     perct\n",
       "0             year         0  0.000000\n",
       "1            month         0  0.000000\n",
       "2              day         0  0.000000\n",
       "3         dep_time      8255  2.451184\n",
       "4   sched_dep_time         0  0.000000\n",
       "5        dep_delay      8255  2.451184\n",
       "6         arr_time      8713  2.587180\n",
       "7   sched_arr_time         0  0.000000\n",
       "8        arr_delay      9430  2.800081\n",
       "9          carrier         0  0.000000\n",
       "10          flight         0  0.000000\n",
       "11         tailnum      2512  0.745896\n",
       "12          origin         0  0.000000\n",
       "13            dest         0  0.000000\n",
       "14        air_time      9430  2.800081\n",
       "15        distance         0  0.000000\n",
       "16            hour         0  0.000000\n",
       "17          minute         0  0.000000\n",
       "18       time_hour         0  0.000000"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "flights_df1.isna().any(axis=0) # 查看缺失值\n",
    "\n",
    "(flights_df1.isna()\n",
    " .sum(axis=0)\n",
    " .reset_index()\n",
    " .set_axis(['colname', 'na_count'], axis=1) # 缺失值数量\n",
    " .eval(\"perct = na_count/@flights_df1.shape[0]*100\", engine='python') # 缺失值比例\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2013-01-01 18:00:00')"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "Timestamp('2014-01-01 12:00:00')"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看时间范围\n",
    "flights_df1['time_hour'].min()\n",
    "flights_df1['time_hour'].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>year</th>\n",
       "      <th>month</th>\n",
       "      <th>day</th>\n",
       "      <th>dep_time</th>\n",
       "      <th>sched_dep_time</th>\n",
       "      <th>dep_delay</th>\n",
       "      <th>arr_time</th>\n",
       "      <th>sched_arr_time</th>\n",
       "      <th>arr_delay</th>\n",
       "      <th>flight</th>\n",
       "      <th>air_time</th>\n",
       "      <th>distance</th>\n",
       "      <th>hour</th>\n",
       "      <th>minute</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>336776.0</td>\n",
       "      <td>336776.000000</td>\n",
       "      <td>336776.000000</td>\n",
       "      <td>328521.000000</td>\n",
       "      <td>336776.000000</td>\n",
       "      <td>328521.000000</td>\n",
       "      <td>328063.000000</td>\n",
       "      <td>336776.000000</td>\n",
       "      <td>327346.000000</td>\n",
       "      <td>336776.000000</td>\n",
       "      <td>327346.000000</td>\n",
       "      <td>336776.000000</td>\n",
       "      <td>336776.000000</td>\n",
       "      <td>336776.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>2013.0</td>\n",
       "      <td>6.548510</td>\n",
       "      <td>15.710787</td>\n",
       "      <td>1349.109947</td>\n",
       "      <td>1344.254840</td>\n",
       "      <td>12.639070</td>\n",
       "      <td>1502.054999</td>\n",
       "      <td>1536.380220</td>\n",
       "      <td>6.895377</td>\n",
       "      <td>1971.923620</td>\n",
       "      <td>150.686460</td>\n",
       "      <td>1039.912604</td>\n",
       "      <td>13.180247</td>\n",
       "      <td>26.230100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.0</td>\n",
       "      <td>3.414457</td>\n",
       "      <td>8.768607</td>\n",
       "      <td>488.281791</td>\n",
       "      <td>467.335756</td>\n",
       "      <td>40.210061</td>\n",
       "      <td>533.264132</td>\n",
       "      <td>497.457142</td>\n",
       "      <td>44.633292</td>\n",
       "      <td>1632.471938</td>\n",
       "      <td>93.688305</td>\n",
       "      <td>733.233033</td>\n",
       "      <td>4.661316</td>\n",
       "      <td>19.300846</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>2013.0</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>106.000000</td>\n",
       "      <td>-43.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>-86.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>17.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>2013.0</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>907.000000</td>\n",
       "      <td>906.000000</td>\n",
       "      <td>-5.000000</td>\n",
       "      <td>1104.000000</td>\n",
       "      <td>1124.000000</td>\n",
       "      <td>-17.000000</td>\n",
       "      <td>553.000000</td>\n",
       "      <td>82.000000</td>\n",
       "      <td>502.000000</td>\n",
       "      <td>9.000000</td>\n",
       "      <td>8.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>2013.0</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>16.000000</td>\n",
       "      <td>1401.000000</td>\n",
       "      <td>1359.000000</td>\n",
       "      <td>-2.000000</td>\n",
       "      <td>1535.000000</td>\n",
       "      <td>1556.000000</td>\n",
       "      <td>-5.000000</td>\n",
       "      <td>1496.000000</td>\n",
       "      <td>129.000000</td>\n",
       "      <td>872.000000</td>\n",
       "      <td>13.000000</td>\n",
       "      <td>29.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>2013.0</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>23.000000</td>\n",
       "      <td>1744.000000</td>\n",
       "      <td>1729.000000</td>\n",
       "      <td>11.000000</td>\n",
       "      <td>1940.000000</td>\n",
       "      <td>1945.000000</td>\n",
       "      <td>14.000000</td>\n",
       "      <td>3465.000000</td>\n",
       "      <td>192.000000</td>\n",
       "      <td>1389.000000</td>\n",
       "      <td>17.000000</td>\n",
       "      <td>44.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>2013.0</td>\n",
       "      <td>12.000000</td>\n",
       "      <td>31.000000</td>\n",
       "      <td>2400.000000</td>\n",
       "      <td>2359.000000</td>\n",
       "      <td>1301.000000</td>\n",
       "      <td>2400.000000</td>\n",
       "      <td>2359.000000</td>\n",
       "      <td>1272.000000</td>\n",
       "      <td>8500.000000</td>\n",
       "      <td>695.000000</td>\n",
       "      <td>4983.000000</td>\n",
       "      <td>23.000000</td>\n",
       "      <td>59.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           year          month            day       dep_time  sched_dep_time  \\\n",
       "count  336776.0  336776.000000  336776.000000  328521.000000   336776.000000   \n",
       "mean     2013.0       6.548510      15.710787    1349.109947     1344.254840   \n",
       "std         0.0       3.414457       8.768607     488.281791      467.335756   \n",
       "min      2013.0       1.000000       1.000000       1.000000      106.000000   \n",
       "25%      2013.0       4.000000       8.000000     907.000000      906.000000   \n",
       "50%      2013.0       7.000000      16.000000    1401.000000     1359.000000   \n",
       "75%      2013.0      10.000000      23.000000    1744.000000     1729.000000   \n",
       "max      2013.0      12.000000      31.000000    2400.000000     2359.000000   \n",
       "\n",
       "           dep_delay       arr_time  sched_arr_time      arr_delay  \\\n",
       "count  328521.000000  328063.000000   336776.000000  327346.000000   \n",
       "mean       12.639070    1502.054999     1536.380220       6.895377   \n",
       "std        40.210061     533.264132      497.457142      44.633292   \n",
       "min       -43.000000       1.000000        1.000000     -86.000000   \n",
       "25%        -5.000000    1104.000000     1124.000000     -17.000000   \n",
       "50%        -2.000000    1535.000000     1556.000000      -5.000000   \n",
       "75%        11.000000    1940.000000     1945.000000      14.000000   \n",
       "max      1301.000000    2400.000000     2359.000000    1272.000000   \n",
       "\n",
       "              flight       air_time       distance           hour  \\\n",
       "count  336776.000000  327346.000000  336776.000000  336776.000000   \n",
       "mean     1971.923620     150.686460    1039.912604      13.180247   \n",
       "std      1632.471938      93.688305     733.233033       4.661316   \n",
       "min         1.000000      20.000000      17.000000       1.000000   \n",
       "25%       553.000000      82.000000     502.000000       9.000000   \n",
       "50%      1496.000000     129.000000     872.000000      13.000000   \n",
       "75%      3465.000000     192.000000    1389.000000      17.000000   \n",
       "max      8500.000000     695.000000    4983.000000      23.000000   \n",
       "\n",
       "              minute  \n",
       "count  336776.000000  \n",
       "mean       26.230100  \n",
       "std        19.300846  \n",
       "min         0.000000  \n",
       "25%         8.000000  \n",
       "50%        29.000000  \n",
       "75%        44.000000  \n",
       "max        59.000000  "
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 统计数字变量分布\n",
    "flights_df1.describe(include='number')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "carrier      16\n",
       "tailnum    4043\n",
       "origin        3\n",
       "dest        105\n",
       "dtype: int64"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "flights_df1[['carrier', 'tailnum', 'origin', 'dest']].agg('nunique')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看出字段'tailnum'不属于因子变量，字段'dest'目的地，也不属于因子变量。对其它2个变量计频。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>carrier</th>\n",
       "      <th>freq</th>\n",
       "      <th>perct</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>9E</td>\n",
       "      <td>18460</td>\n",
       "      <td>5.481388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>AA</td>\n",
       "      <td>32729</td>\n",
       "      <td>9.718329</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>AS</td>\n",
       "      <td>714</td>\n",
       "      <td>0.212010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>B6</td>\n",
       "      <td>54635</td>\n",
       "      <td>16.222949</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>DL</td>\n",
       "      <td>48110</td>\n",
       "      <td>14.285460</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>EV</td>\n",
       "      <td>54173</td>\n",
       "      <td>16.085766</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>F9</td>\n",
       "      <td>685</td>\n",
       "      <td>0.203399</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>FL</td>\n",
       "      <td>3260</td>\n",
       "      <td>0.968002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>HA</td>\n",
       "      <td>342</td>\n",
       "      <td>0.101551</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>MQ</td>\n",
       "      <td>26397</td>\n",
       "      <td>7.838148</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>OO</td>\n",
       "      <td>32</td>\n",
       "      <td>0.009502</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>UA</td>\n",
       "      <td>58665</td>\n",
       "      <td>17.419590</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>US</td>\n",
       "      <td>20536</td>\n",
       "      <td>6.097822</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>VX</td>\n",
       "      <td>5162</td>\n",
       "      <td>1.532770</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>WN</td>\n",
       "      <td>12275</td>\n",
       "      <td>3.644856</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>YV</td>\n",
       "      <td>601</td>\n",
       "      <td>0.178457</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   carrier   freq      perct\n",
       "0       9E  18460   5.481388\n",
       "1       AA  32729   9.718329\n",
       "2       AS    714   0.212010\n",
       "3       B6  54635  16.222949\n",
       "4       DL  48110  14.285460\n",
       "5       EV  54173  16.085766\n",
       "6       F9    685   0.203399\n",
       "7       FL   3260   0.968002\n",
       "8       HA    342   0.101551\n",
       "9       MQ  26397   7.838148\n",
       "10      OO     32   0.009502\n",
       "11      UA  58665  17.419590\n",
       "12      US  20536   6.097822\n",
       "13      VX   5162   1.532770\n",
       "14      WN  12275   3.644856\n",
       "15      YV    601   0.178457"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>origin</th>\n",
       "      <th>freq</th>\n",
       "      <th>perct</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>EWR</td>\n",
       "      <td>120835</td>\n",
       "      <td>35.879932</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>JFK</td>\n",
       "      <td>111279</td>\n",
       "      <td>33.042438</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>LGA</td>\n",
       "      <td>104662</td>\n",
       "      <td>31.077630</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  origin    freq      perct\n",
       "0    EWR  120835  35.879932\n",
       "1    JFK  111279  33.042438\n",
       "2    LGA  104662  31.077630"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 统计频率\n",
    "for col in ['carrier', 'origin']:\n",
    "    (flights_df1[col].value_counts()\n",
    "     .sort_index()\n",
    "     .reset_index()\n",
    "     .set_axis([col, 'freq'], axis=1)\n",
    "     .eval(\"perct = freq / freq.sum()*100\", engine='python')\n",
    "    )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# EDA"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>dep_time</th>\n",
       "      <th>sched_dep_time</th>\n",
       "      <th>dep_delay</th>\n",
       "      <th>arr_time</th>\n",
       "      <th>sched_arr_time</th>\n",
       "      <th>arr_delay</th>\n",
       "      <th>carrier</th>\n",
       "      <th>flight</th>\n",
       "      <th>tailnum</th>\n",
       "      <th>origin</th>\n",
       "      <th>dest</th>\n",
       "      <th>air_time</th>\n",
       "      <th>distance</th>\n",
       "      <th>time_hour</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>event_time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2013-01-01 05:15:00</th>\n",
       "      <td>517.0</td>\n",
       "      <td>515</td>\n",
       "      <td>2.0</td>\n",
       "      <td>830.0</td>\n",
       "      <td>819</td>\n",
       "      <td>11.0</td>\n",
       "      <td>UA</td>\n",
       "      <td>1545</td>\n",
       "      <td>N14228</td>\n",
       "      <td>EWR</td>\n",
       "      <td>IAH</td>\n",
       "      <td>227.0</td>\n",
       "      <td>1400</td>\n",
       "      <td>2013-01-01 18:00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 05:29:00</th>\n",
       "      <td>533.0</td>\n",
       "      <td>529</td>\n",
       "      <td>4.0</td>\n",
       "      <td>850.0</td>\n",
       "      <td>830</td>\n",
       "      <td>20.0</td>\n",
       "      <td>UA</td>\n",
       "      <td>1714</td>\n",
       "      <td>N24211</td>\n",
       "      <td>LGA</td>\n",
       "      <td>IAH</td>\n",
       "      <td>227.0</td>\n",
       "      <td>1416</td>\n",
       "      <td>2013-01-01 18:00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 05:40:00</th>\n",
       "      <td>542.0</td>\n",
       "      <td>540</td>\n",
       "      <td>2.0</td>\n",
       "      <td>923.0</td>\n",
       "      <td>850</td>\n",
       "      <td>33.0</td>\n",
       "      <td>AA</td>\n",
       "      <td>1141</td>\n",
       "      <td>N619AA</td>\n",
       "      <td>JFK</td>\n",
       "      <td>MIA</td>\n",
       "      <td>160.0</td>\n",
       "      <td>1089</td>\n",
       "      <td>2013-01-01 18:00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 05:45:00</th>\n",
       "      <td>544.0</td>\n",
       "      <td>545</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>1004.0</td>\n",
       "      <td>1022</td>\n",
       "      <td>-18.0</td>\n",
       "      <td>B6</td>\n",
       "      <td>725</td>\n",
       "      <td>N804JB</td>\n",
       "      <td>JFK</td>\n",
       "      <td>BQN</td>\n",
       "      <td>183.0</td>\n",
       "      <td>1576</td>\n",
       "      <td>2013-01-01 18:00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 06:00:00</th>\n",
       "      <td>554.0</td>\n",
       "      <td>600</td>\n",
       "      <td>-6.0</td>\n",
       "      <td>812.0</td>\n",
       "      <td>837</td>\n",
       "      <td>-25.0</td>\n",
       "      <td>DL</td>\n",
       "      <td>461</td>\n",
       "      <td>N668DN</td>\n",
       "      <td>LGA</td>\n",
       "      <td>ATL</td>\n",
       "      <td>116.0</td>\n",
       "      <td>762</td>\n",
       "      <td>2013-01-01 19:00:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     dep_time  sched_dep_time  dep_delay  arr_time  \\\n",
       "event_time                                                           \n",
       "2013-01-01 05:15:00     517.0             515        2.0     830.0   \n",
       "2013-01-01 05:29:00     533.0             529        4.0     850.0   \n",
       "2013-01-01 05:40:00     542.0             540        2.0     923.0   \n",
       "2013-01-01 05:45:00     544.0             545       -1.0    1004.0   \n",
       "2013-01-01 06:00:00     554.0             600       -6.0     812.0   \n",
       "\n",
       "                     sched_arr_time  arr_delay carrier  flight tailnum origin  \\\n",
       "event_time                                                                      \n",
       "2013-01-01 05:15:00             819       11.0      UA    1545  N14228    EWR   \n",
       "2013-01-01 05:29:00             830       20.0      UA    1714  N24211    LGA   \n",
       "2013-01-01 05:40:00             850       33.0      AA    1141  N619AA    JFK   \n",
       "2013-01-01 05:45:00            1022      -18.0      B6     725  N804JB    JFK   \n",
       "2013-01-01 06:00:00             837      -25.0      DL     461  N668DN    LGA   \n",
       "\n",
       "                    dest  air_time  distance           time_hour  \n",
       "event_time                                                        \n",
       "2013-01-01 05:15:00  IAH     227.0      1400 2013-01-01 18:00:00  \n",
       "2013-01-01 05:29:00  IAH     227.0      1416 2013-01-01 18:00:00  \n",
       "2013-01-01 05:40:00  MIA     160.0      1089 2013-01-01 18:00:00  \n",
       "2013-01-01 05:45:00  BQN     183.0      1576 2013-01-01 18:00:00  \n",
       "2013-01-01 06:00:00  ATL     116.0       762 2013-01-01 19:00:00  "
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "flights_df2 = flights_df1.copy()\n",
    "flights_df2['event_time'] = pd.to_datetime(flights_df2[['year', 'month', 'day', 'hour', 'minute']])\n",
    "flights_df2.drop(['year', 'month', 'day', 'hour', 'minute'], axis=1, inplace=True)\n",
    "flights_df2.set_index('event_time', inplace=True)\n",
    "flights_df2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>event_date</th>\n",
       "      <th>freq</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2013-01-01</td>\n",
       "      <td>842</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2013-01-02</td>\n",
       "      <td>943</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2013-01-03</td>\n",
       "      <td>914</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2013-01-04</td>\n",
       "      <td>915</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2013-01-05</td>\n",
       "      <td>720</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  event_date  freq\n",
       "0 2013-01-01   842\n",
       "1 2013-01-02   943\n",
       "2 2013-01-03   914\n",
       "3 2013-01-04   915\n",
       "4 2013-01-05   720"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_daily = (flights_df2.groupby(pd.Grouper(level='event_time', freq='D'))['origin']\n",
    "            .count()\n",
    "            .sort_index()\n",
    "            .reset_index()\n",
    "            .set_axis(['event_date', 'freq'], axis=1)\n",
    "           )\n",
    "df_daily.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'chalk':'https://assets.pyecharts.org/assets/themes/chalk'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"f6ad290a34fe4f2d9477872340685481\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'chalk'], function(echarts) {\n",
       "                var chart_f6ad290a34fe4f2d9477872340685481 = echarts.init(\n",
       "                    document.getElementById('f6ad290a34fe4f2d9477872340685481'), 'chalk', {renderer: 'canvas'});\n",
       "                var option_f6ad290a34fe4f2d9477872340685481 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"2013-01-01\",\n",
       "                    842\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-02\",\n",
       "                    943\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-03\",\n",
       "                    914\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-04\",\n",
       "                    915\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-05\",\n",
       "                    720\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-06\",\n",
       "                    832\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-07\",\n",
       "                    933\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-08\",\n",
       "                    899\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-09\",\n",
       "                    902\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-10\",\n",
       "                    932\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-11\",\n",
       "                    930\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-12\",\n",
       "                    690\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-13\",\n",
       "                    828\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-14\",\n",
       "                    928\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-15\",\n",
       "                    894\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-16\",\n",
       "                    901\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-17\",\n",
       "                    927\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-18\",\n",
       "                    924\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-19\",\n",
       "                    674\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-20\",\n",
       "                    786\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-21\",\n",
       "                    912\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-22\",\n",
       "                    890\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-23\",\n",
       "                    897\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-24\",\n",
       "                    925\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-25\",\n",
       "                    922\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-26\",\n",
       "                    680\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-27\",\n",
       "                    823\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-28\",\n",
       "                    923\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-29\",\n",
       "                    890\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-30\",\n",
       "                    900\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-31\",\n",
       "                    928\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-01\",\n",
       "                    926\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-02\",\n",
       "                    682\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-03\",\n",
       "                    814\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-04\",\n",
       "                    932\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-05\",\n",
       "                    896\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-06\",\n",
       "                    901\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-07\",\n",
       "                    932\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-08\",\n",
       "                    930\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-09\",\n",
       "                    684\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-10\",\n",
       "                    829\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-11\",\n",
       "                    929\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-12\",\n",
       "                    893\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-13\",\n",
       "                    918\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-14\",\n",
       "                    956\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-15\",\n",
       "                    954\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-16\",\n",
       "                    738\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-17\",\n",
       "                    848\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-18\",\n",
       "                    948\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-19\",\n",
       "                    943\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-20\",\n",
       "                    949\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-21\",\n",
       "                    961\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-22\",\n",
       "                    957\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-23\",\n",
       "                    743\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-24\",\n",
       "                    880\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-25\",\n",
       "                    961\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-26\",\n",
       "                    938\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-27\",\n",
       "                    945\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-28\",\n",
       "                    964\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-01\",\n",
       "                    958\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-02\",\n",
       "                    765\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-03\",\n",
       "                    913\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-04\",\n",
       "                    977\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-05\",\n",
       "                    965\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-06\",\n",
       "                    972\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-07\",\n",
       "                    980\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-08\",\n",
       "                    979\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-09\",\n",
       "                    765\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-10\",\n",
       "                    908\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-11\",\n",
       "                    980\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-12\",\n",
       "                    966\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-13\",\n",
       "                    974\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-14\",\n",
       "                    982\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-15\",\n",
       "                    979\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-16\",\n",
       "                    767\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-17\",\n",
       "                    907\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-18\",\n",
       "                    981\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-19\",\n",
       "                    967\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-20\",\n",
       "                    970\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-21\",\n",
       "                    980\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-22\",\n",
       "                    977\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-23\",\n",
       "                    767\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-24\",\n",
       "                    905\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-25\",\n",
       "                    978\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-26\",\n",
       "                    973\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-27\",\n",
       "                    977\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-28\",\n",
       "                    982\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-29\",\n",
       "                    974\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-30\",\n",
       "                    769\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-31\",\n",
       "                    897\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-01\",\n",
       "                    970\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-02\",\n",
       "                    983\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-03\",\n",
       "                    992\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-04\",\n",
       "                    985\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-05\",\n",
       "                    981\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-06\",\n",
       "                    770\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-07\",\n",
       "                    911\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-08\",\n",
       "                    981\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-09\",\n",
       "                    975\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-10\",\n",
       "                    989\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-11\",\n",
       "                    992\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-12\",\n",
       "                    989\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-13\",\n",
       "                    770\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-14\",\n",
       "                    917\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-15\",\n",
       "                    995\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-16\",\n",
       "                    974\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-17\",\n",
       "                    988\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-18\",\n",
       "                    992\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-19\",\n",
       "                    988\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-20\",\n",
       "                    766\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-21\",\n",
       "                    919\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-22\",\n",
       "                    985\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-23\",\n",
       "                    965\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-24\",\n",
       "                    976\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-25\",\n",
       "                    983\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-26\",\n",
       "                    981\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-27\",\n",
       "                    757\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-28\",\n",
       "                    913\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-29\",\n",
       "                    983\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-30\",\n",
       "                    960\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-01\",\n",
       "                    964\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-02\",\n",
       "                    983\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-03\",\n",
       "                    978\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-04\",\n",
       "                    745\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-05\",\n",
       "                    912\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-06\",\n",
       "                    980\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-07\",\n",
       "                    955\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-08\",\n",
       "                    965\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-09\",\n",
       "                    981\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-10\",\n",
       "                    978\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-11\",\n",
       "                    738\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-12\",\n",
       "                    896\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-13\",\n",
       "                    979\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-14\",\n",
       "                    955\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-15\",\n",
       "                    967\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-16\",\n",
       "                    982\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-17\",\n",
       "                    980\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-18\",\n",
       "                    749\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-19\",\n",
       "                    911\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-20\",\n",
       "                    983\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-21\",\n",
       "                    962\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-22\",\n",
       "                    972\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-23\",\n",
       "                    988\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-24\",\n",
       "                    978\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-25\",\n",
       "                    728\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-26\",\n",
       "                    729\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-27\",\n",
       "                    928\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-28\",\n",
       "                    981\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-29\",\n",
       "                    974\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-30\",\n",
       "                    989\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-31\",\n",
       "                    986\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-01\",\n",
       "                    754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-02\",\n",
       "                    911\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-03\",\n",
       "                    982\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-04\",\n",
       "                    960\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-05\",\n",
       "                    970\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-06\",\n",
       "                    976\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-07\",\n",
       "                    975\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-08\",\n",
       "                    779\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-09\",\n",
       "                    908\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-10\",\n",
       "                    987\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-11\",\n",
       "                    980\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-12\",\n",
       "                    983\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-13\",\n",
       "                    989\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-14\",\n",
       "                    989\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-15\",\n",
       "                    801\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-16\",\n",
       "                    918\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-17\",\n",
       "                    990\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-18\",\n",
       "                    982\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-19\",\n",
       "                    985\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-20\",\n",
       "                    995\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-21\",\n",
       "                    993\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-22\",\n",
       "                    812\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-23\",\n",
       "                    923\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-24\",\n",
       "                    994\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-25\",\n",
       "                    993\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-26\",\n",
       "                    995\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-27\",\n",
       "                    995\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-28\",\n",
       "                    994\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-29\",\n",
       "                    812\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-30\",\n",
       "                    918\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-01\",\n",
       "                    966\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-02\",\n",
       "                    945\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-03\",\n",
       "                    983\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-04\",\n",
       "                    737\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-05\",\n",
       "                    822\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-06\",\n",
       "                    805\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-07\",\n",
       "                    934\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-08\",\n",
       "                    1004\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-09\",\n",
       "                    1001\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-10\",\n",
       "                    1004\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-11\",\n",
       "                    1006\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-12\",\n",
       "                    1002\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-13\",\n",
       "                    811\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-14\",\n",
       "                    931\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-15\",\n",
       "                    999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-16\",\n",
       "                    996\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-17\",\n",
       "                    1001\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-18\",\n",
       "                    1003\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-19\",\n",
       "                    999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-20\",\n",
       "                    810\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-21\",\n",
       "                    929\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-22\",\n",
       "                    1000\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-23\",\n",
       "                    997\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-24\",\n",
       "                    1000\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-25\",\n",
       "                    1003\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-26\",\n",
       "                    999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-27\",\n",
       "                    811\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-28\",\n",
       "                    930\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-29\",\n",
       "                    999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-30\",\n",
       "                    997\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-31\",\n",
       "                    1001\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-01\",\n",
       "                    1000\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-02\",\n",
       "                    999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-03\",\n",
       "                    809\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-04\",\n",
       "                    929\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-05\",\n",
       "                    1000\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-06\",\n",
       "                    996\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-07\",\n",
       "                    1001\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-08\",\n",
       "                    1001\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-09\",\n",
       "                    999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-10\",\n",
       "                    807\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-11\",\n",
       "                    929\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-12\",\n",
       "                    1001\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-13\",\n",
       "                    995\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-14\",\n",
       "                    997\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-15\",\n",
       "                    1000\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-16\",\n",
       "                    998\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-17\",\n",
       "                    780\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-18\",\n",
       "                    914\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-19\",\n",
       "                    996\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-20\",\n",
       "                    986\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-21\",\n",
       "                    990\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-22\",\n",
       "                    990\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-23\",\n",
       "                    989\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-24\",\n",
       "                    774\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-25\",\n",
       "                    903\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-26\",\n",
       "                    982\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-27\",\n",
       "                    965\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-28\",\n",
       "                    973\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-29\",\n",
       "                    979\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-30\",\n",
       "                    965\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-31\",\n",
       "                    680\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-01\",\n",
       "                    718\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-02\",\n",
       "                    929\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-03\",\n",
       "                    956\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-04\",\n",
       "                    948\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-05\",\n",
       "                    969\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-06\",\n",
       "                    967\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-07\",\n",
       "                    688\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-08\",\n",
       "                    908\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-09\",\n",
       "                    991\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-10\",\n",
       "                    961\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-11\",\n",
       "                    947\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-12\",\n",
       "                    992\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-13\",\n",
       "                    996\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-14\",\n",
       "                    686\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-15\",\n",
       "                    900\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-16\",\n",
       "                    992\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-17\",\n",
       "                    961\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-18\",\n",
       "                    972\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-19\",\n",
       "                    992\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-20\",\n",
       "                    994\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-21\",\n",
       "                    693\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-22\",\n",
       "                    904\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-23\",\n",
       "                    993\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-24\",\n",
       "                    960\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-25\",\n",
       "                    976\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-26\",\n",
       "                    996\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-27\",\n",
       "                    996\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-28\",\n",
       "                    682\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-29\",\n",
       "                    914\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-30\",\n",
       "                    993\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-01\",\n",
       "                    965\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-02\",\n",
       "                    975\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-03\",\n",
       "                    995\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-04\",\n",
       "                    995\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-05\",\n",
       "                    687\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-06\",\n",
       "                    917\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-07\",\n",
       "                    994\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-08\",\n",
       "                    964\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-09\",\n",
       "                    974\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-10\",\n",
       "                    994\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-11\",\n",
       "                    991\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-12\",\n",
       "                    676\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-13\",\n",
       "                    902\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-14\",\n",
       "                    987\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-15\",\n",
       "                    963\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-16\",\n",
       "                    974\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-17\",\n",
       "                    995\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-18\",\n",
       "                    993\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-19\",\n",
       "                    684\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-20\",\n",
       "                    915\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-21\",\n",
       "                    991\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-22\",\n",
       "                    964\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-23\",\n",
       "                    975\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-24\",\n",
       "                    992\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-25\",\n",
       "                    989\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-26\",\n",
       "                    685\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-27\",\n",
       "                    910\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-28\",\n",
       "                    983\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-29\",\n",
       "                    965\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-30\",\n",
       "                    973\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-31\",\n",
       "                    922\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-01\",\n",
       "                    986\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-02\",\n",
       "                    689\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-03\",\n",
       "                    902\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-04\",\n",
       "                    978\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-05\",\n",
       "                    967\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-06\",\n",
       "                    973\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-07\",\n",
       "                    991\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-08\",\n",
       "                    986\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-09\",\n",
       "                    715\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-10\",\n",
       "                    895\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-11\",\n",
       "                    983\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-12\",\n",
       "                    973\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-13\",\n",
       "                    976\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-14\",\n",
       "                    988\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-15\",\n",
       "                    985\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-16\",\n",
       "                    714\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-17\",\n",
       "                    896\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-18\",\n",
       "                    985\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-19\",\n",
       "                    973\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-20\",\n",
       "                    977\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-21\",\n",
       "                    1000\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-22\",\n",
       "                    999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-23\",\n",
       "                    744\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-24\",\n",
       "                    896\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-25\",\n",
       "                    942\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-26\",\n",
       "                    989\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-27\",\n",
       "                    1014\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-28\",\n",
       "                    634\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-29\",\n",
       "                    661\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-30\",\n",
       "                    857\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-01\",\n",
       "                    987\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-02\",\n",
       "                    1004\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-03\",\n",
       "                    973\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-04\",\n",
       "                    958\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-05\",\n",
       "                    969\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-06\",\n",
       "                    970\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-07\",\n",
       "                    691\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-08\",\n",
       "                    875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-09\",\n",
       "                    962\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-10\",\n",
       "                    943\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-11\",\n",
       "                    954\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-12\",\n",
       "                    968\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-13\",\n",
       "                    970\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-14\",\n",
       "                    692\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-15\",\n",
       "                    880\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-16\",\n",
       "                    964\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-17\",\n",
       "                    949\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-18\",\n",
       "                    956\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-19\",\n",
       "                    974\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-20\",\n",
       "                    980\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-21\",\n",
       "                    811\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-22\",\n",
       "                    895\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-23\",\n",
       "                    985\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-24\",\n",
       "                    761\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-25\",\n",
       "                    719\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-26\",\n",
       "                    936\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-27\",\n",
       "                    963\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-28\",\n",
       "                    814\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-29\",\n",
       "                    888\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-30\",\n",
       "                    968\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-31\",\n",
       "                    776\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"2013-01-01\",\n",
       "                \"2013-01-02\",\n",
       "                \"2013-01-03\",\n",
       "                \"2013-01-04\",\n",
       "                \"2013-01-05\",\n",
       "                \"2013-01-06\",\n",
       "                \"2013-01-07\",\n",
       "                \"2013-01-08\",\n",
       "                \"2013-01-09\",\n",
       "                \"2013-01-10\",\n",
       "                \"2013-01-11\",\n",
       "                \"2013-01-12\",\n",
       "                \"2013-01-13\",\n",
       "                \"2013-01-14\",\n",
       "                \"2013-01-15\",\n",
       "                \"2013-01-16\",\n",
       "                \"2013-01-17\",\n",
       "                \"2013-01-18\",\n",
       "                \"2013-01-19\",\n",
       "                \"2013-01-20\",\n",
       "                \"2013-01-21\",\n",
       "                \"2013-01-22\",\n",
       "                \"2013-01-23\",\n",
       "                \"2013-01-24\",\n",
       "                \"2013-01-25\",\n",
       "                \"2013-01-26\",\n",
       "                \"2013-01-27\",\n",
       "                \"2013-01-28\",\n",
       "                \"2013-01-29\",\n",
       "                \"2013-01-30\",\n",
       "                \"2013-01-31\",\n",
       "                \"2013-02-01\",\n",
       "                \"2013-02-02\",\n",
       "                \"2013-02-03\",\n",
       "                \"2013-02-04\",\n",
       "                \"2013-02-05\",\n",
       "                \"2013-02-06\",\n",
       "                \"2013-02-07\",\n",
       "                \"2013-02-08\",\n",
       "                \"2013-02-09\",\n",
       "                \"2013-02-10\",\n",
       "                \"2013-02-11\",\n",
       "                \"2013-02-12\",\n",
       "                \"2013-02-13\",\n",
       "                \"2013-02-14\",\n",
       "                \"2013-02-15\",\n",
       "                \"2013-02-16\",\n",
       "                \"2013-02-17\",\n",
       "                \"2013-02-18\",\n",
       "                \"2013-02-19\",\n",
       "                \"2013-02-20\",\n",
       "                \"2013-02-21\",\n",
       "                \"2013-02-22\",\n",
       "                \"2013-02-23\",\n",
       "                \"2013-02-24\",\n",
       "                \"2013-02-25\",\n",
       "                \"2013-02-26\",\n",
       "                \"2013-02-27\",\n",
       "                \"2013-02-28\",\n",
       "                \"2013-03-01\",\n",
       "                \"2013-03-02\",\n",
       "                \"2013-03-03\",\n",
       "                \"2013-03-04\",\n",
       "                \"2013-03-05\",\n",
       "                \"2013-03-06\",\n",
       "                \"2013-03-07\",\n",
       "                \"2013-03-08\",\n",
       "                \"2013-03-09\",\n",
       "                \"2013-03-10\",\n",
       "                \"2013-03-11\",\n",
       "                \"2013-03-12\",\n",
       "                \"2013-03-13\",\n",
       "                \"2013-03-14\",\n",
       "                \"2013-03-15\",\n",
       "                \"2013-03-16\",\n",
       "                \"2013-03-17\",\n",
       "                \"2013-03-18\",\n",
       "                \"2013-03-19\",\n",
       "                \"2013-03-20\",\n",
       "                \"2013-03-21\",\n",
       "                \"2013-03-22\",\n",
       "                \"2013-03-23\",\n",
       "                \"2013-03-24\",\n",
       "                \"2013-03-25\",\n",
       "                \"2013-03-26\",\n",
       "                \"2013-03-27\",\n",
       "                \"2013-03-28\",\n",
       "                \"2013-03-29\",\n",
       "                \"2013-03-30\",\n",
       "                \"2013-03-31\",\n",
       "                \"2013-04-01\",\n",
       "                \"2013-04-02\",\n",
       "                \"2013-04-03\",\n",
       "                \"2013-04-04\",\n",
       "                \"2013-04-05\",\n",
       "                \"2013-04-06\",\n",
       "                \"2013-04-07\",\n",
       "                \"2013-04-08\",\n",
       "                \"2013-04-09\",\n",
       "                \"2013-04-10\",\n",
       "                \"2013-04-11\",\n",
       "                \"2013-04-12\",\n",
       "                \"2013-04-13\",\n",
       "                \"2013-04-14\",\n",
       "                \"2013-04-15\",\n",
       "                \"2013-04-16\",\n",
       "                \"2013-04-17\",\n",
       "                \"2013-04-18\",\n",
       "                \"2013-04-19\",\n",
       "                \"2013-04-20\",\n",
       "                \"2013-04-21\",\n",
       "                \"2013-04-22\",\n",
       "                \"2013-04-23\",\n",
       "                \"2013-04-24\",\n",
       "                \"2013-04-25\",\n",
       "                \"2013-04-26\",\n",
       "                \"2013-04-27\",\n",
       "                \"2013-04-28\",\n",
       "                \"2013-04-29\",\n",
       "                \"2013-04-30\",\n",
       "                \"2013-05-01\",\n",
       "                \"2013-05-02\",\n",
       "                \"2013-05-03\",\n",
       "                \"2013-05-04\",\n",
       "                \"2013-05-05\",\n",
       "                \"2013-05-06\",\n",
       "                \"2013-05-07\",\n",
       "                \"2013-05-08\",\n",
       "                \"2013-05-09\",\n",
       "                \"2013-05-10\",\n",
       "                \"2013-05-11\",\n",
       "                \"2013-05-12\",\n",
       "                \"2013-05-13\",\n",
       "                \"2013-05-14\",\n",
       "                \"2013-05-15\",\n",
       "                \"2013-05-16\",\n",
       "                \"2013-05-17\",\n",
       "                \"2013-05-18\",\n",
       "                \"2013-05-19\",\n",
       "                \"2013-05-20\",\n",
       "                \"2013-05-21\",\n",
       "                \"2013-05-22\",\n",
       "                \"2013-05-23\",\n",
       "                \"2013-05-24\",\n",
       "                \"2013-05-25\",\n",
       "                \"2013-05-26\",\n",
       "                \"2013-05-27\",\n",
       "                \"2013-05-28\",\n",
       "                \"2013-05-29\",\n",
       "                \"2013-05-30\",\n",
       "                \"2013-05-31\",\n",
       "                \"2013-06-01\",\n",
       "                \"2013-06-02\",\n",
       "                \"2013-06-03\",\n",
       "                \"2013-06-04\",\n",
       "                \"2013-06-05\",\n",
       "                \"2013-06-06\",\n",
       "                \"2013-06-07\",\n",
       "                \"2013-06-08\",\n",
       "                \"2013-06-09\",\n",
       "                \"2013-06-10\",\n",
       "                \"2013-06-11\",\n",
       "                \"2013-06-12\",\n",
       "                \"2013-06-13\",\n",
       "                \"2013-06-14\",\n",
       "                \"2013-06-15\",\n",
       "                \"2013-06-16\",\n",
       "                \"2013-06-17\",\n",
       "                \"2013-06-18\",\n",
       "                \"2013-06-19\",\n",
       "                \"2013-06-20\",\n",
       "                \"2013-06-21\",\n",
       "                \"2013-06-22\",\n",
       "                \"2013-06-23\",\n",
       "                \"2013-06-24\",\n",
       "                \"2013-06-25\",\n",
       "                \"2013-06-26\",\n",
       "                \"2013-06-27\",\n",
       "                \"2013-06-28\",\n",
       "                \"2013-06-29\",\n",
       "                \"2013-06-30\",\n",
       "                \"2013-07-01\",\n",
       "                \"2013-07-02\",\n",
       "                \"2013-07-03\",\n",
       "                \"2013-07-04\",\n",
       "                \"2013-07-05\",\n",
       "                \"2013-07-06\",\n",
       "                \"2013-07-07\",\n",
       "                \"2013-07-08\",\n",
       "                \"2013-07-09\",\n",
       "                \"2013-07-10\",\n",
       "                \"2013-07-11\",\n",
       "                \"2013-07-12\",\n",
       "                \"2013-07-13\",\n",
       "                \"2013-07-14\",\n",
       "                \"2013-07-15\",\n",
       "                \"2013-07-16\",\n",
       "                \"2013-07-17\",\n",
       "                \"2013-07-18\",\n",
       "                \"2013-07-19\",\n",
       "                \"2013-07-20\",\n",
       "                \"2013-07-21\",\n",
       "                \"2013-07-22\",\n",
       "                \"2013-07-23\",\n",
       "                \"2013-07-24\",\n",
       "                \"2013-07-25\",\n",
       "                \"2013-07-26\",\n",
       "                \"2013-07-27\",\n",
       "                \"2013-07-28\",\n",
       "                \"2013-07-29\",\n",
       "                \"2013-07-30\",\n",
       "                \"2013-07-31\",\n",
       "                \"2013-08-01\",\n",
       "                \"2013-08-02\",\n",
       "                \"2013-08-03\",\n",
       "                \"2013-08-04\",\n",
       "                \"2013-08-05\",\n",
       "                \"2013-08-06\",\n",
       "                \"2013-08-07\",\n",
       "                \"2013-08-08\",\n",
       "                \"2013-08-09\",\n",
       "                \"2013-08-10\",\n",
       "                \"2013-08-11\",\n",
       "                \"2013-08-12\",\n",
       "                \"2013-08-13\",\n",
       "                \"2013-08-14\",\n",
       "                \"2013-08-15\",\n",
       "                \"2013-08-16\",\n",
       "                \"2013-08-17\",\n",
       "                \"2013-08-18\",\n",
       "                \"2013-08-19\",\n",
       "                \"2013-08-20\",\n",
       "                \"2013-08-21\",\n",
       "                \"2013-08-22\",\n",
       "                \"2013-08-23\",\n",
       "                \"2013-08-24\",\n",
       "                \"2013-08-25\",\n",
       "                \"2013-08-26\",\n",
       "                \"2013-08-27\",\n",
       "                \"2013-08-28\",\n",
       "                \"2013-08-29\",\n",
       "                \"2013-08-30\",\n",
       "                \"2013-08-31\",\n",
       "                \"2013-09-01\",\n",
       "                \"2013-09-02\",\n",
       "                \"2013-09-03\",\n",
       "                \"2013-09-04\",\n",
       "                \"2013-09-05\",\n",
       "                \"2013-09-06\",\n",
       "                \"2013-09-07\",\n",
       "                \"2013-09-08\",\n",
       "                \"2013-09-09\",\n",
       "                \"2013-09-10\",\n",
       "                \"2013-09-11\",\n",
       "                \"2013-09-12\",\n",
       "                \"2013-09-13\",\n",
       "                \"2013-09-14\",\n",
       "                \"2013-09-15\",\n",
       "                \"2013-09-16\",\n",
       "                \"2013-09-17\",\n",
       "                \"2013-09-18\",\n",
       "                \"2013-09-19\",\n",
       "                \"2013-09-20\",\n",
       "                \"2013-09-21\",\n",
       "                \"2013-09-22\",\n",
       "                \"2013-09-23\",\n",
       "                \"2013-09-24\",\n",
       "                \"2013-09-25\",\n",
       "                \"2013-09-26\",\n",
       "                \"2013-09-27\",\n",
       "                \"2013-09-28\",\n",
       "                \"2013-09-29\",\n",
       "                \"2013-09-30\",\n",
       "                \"2013-10-01\",\n",
       "                \"2013-10-02\",\n",
       "                \"2013-10-03\",\n",
       "                \"2013-10-04\",\n",
       "                \"2013-10-05\",\n",
       "                \"2013-10-06\",\n",
       "                \"2013-10-07\",\n",
       "                \"2013-10-08\",\n",
       "                \"2013-10-09\",\n",
       "                \"2013-10-10\",\n",
       "                \"2013-10-11\",\n",
       "                \"2013-10-12\",\n",
       "                \"2013-10-13\",\n",
       "                \"2013-10-14\",\n",
       "                \"2013-10-15\",\n",
       "                \"2013-10-16\",\n",
       "                \"2013-10-17\",\n",
       "                \"2013-10-18\",\n",
       "                \"2013-10-19\",\n",
       "                \"2013-10-20\",\n",
       "                \"2013-10-21\",\n",
       "                \"2013-10-22\",\n",
       "                \"2013-10-23\",\n",
       "                \"2013-10-24\",\n",
       "                \"2013-10-25\",\n",
       "                \"2013-10-26\",\n",
       "                \"2013-10-27\",\n",
       "                \"2013-10-28\",\n",
       "                \"2013-10-29\",\n",
       "                \"2013-10-30\",\n",
       "                \"2013-10-31\",\n",
       "                \"2013-11-01\",\n",
       "                \"2013-11-02\",\n",
       "                \"2013-11-03\",\n",
       "                \"2013-11-04\",\n",
       "                \"2013-11-05\",\n",
       "                \"2013-11-06\",\n",
       "                \"2013-11-07\",\n",
       "                \"2013-11-08\",\n",
       "                \"2013-11-09\",\n",
       "                \"2013-11-10\",\n",
       "                \"2013-11-11\",\n",
       "                \"2013-11-12\",\n",
       "                \"2013-11-13\",\n",
       "                \"2013-11-14\",\n",
       "                \"2013-11-15\",\n",
       "                \"2013-11-16\",\n",
       "                \"2013-11-17\",\n",
       "                \"2013-11-18\",\n",
       "                \"2013-11-19\",\n",
       "                \"2013-11-20\",\n",
       "                \"2013-11-21\",\n",
       "                \"2013-11-22\",\n",
       "                \"2013-11-23\",\n",
       "                \"2013-11-24\",\n",
       "                \"2013-11-25\",\n",
       "                \"2013-11-26\",\n",
       "                \"2013-11-27\",\n",
       "                \"2013-11-28\",\n",
       "                \"2013-11-29\",\n",
       "                \"2013-11-30\",\n",
       "                \"2013-12-01\",\n",
       "                \"2013-12-02\",\n",
       "                \"2013-12-03\",\n",
       "                \"2013-12-04\",\n",
       "                \"2013-12-05\",\n",
       "                \"2013-12-06\",\n",
       "                \"2013-12-07\",\n",
       "                \"2013-12-08\",\n",
       "                \"2013-12-09\",\n",
       "                \"2013-12-10\",\n",
       "                \"2013-12-11\",\n",
       "                \"2013-12-12\",\n",
       "                \"2013-12-13\",\n",
       "                \"2013-12-14\",\n",
       "                \"2013-12-15\",\n",
       "                \"2013-12-16\",\n",
       "                \"2013-12-17\",\n",
       "                \"2013-12-18\",\n",
       "                \"2013-12-19\",\n",
       "                \"2013-12-20\",\n",
       "                \"2013-12-21\",\n",
       "                \"2013-12-22\",\n",
       "                \"2013-12-23\",\n",
       "                \"2013-12-24\",\n",
       "                \"2013-12-25\",\n",
       "                \"2013-12-26\",\n",
       "                \"2013-12-27\",\n",
       "                \"2013-12-28\",\n",
       "                \"2013-12-29\",\n",
       "                \"2013-12-30\",\n",
       "                \"2013-12-31\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6bcf\\u5929\\u822a\\u73ed\\u91cf\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"type\": \"png\",\n",
       "                \"backgroundColor\": \"auto\",\n",
       "                \"connectedBackgroundColor\": \"#fff\",\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u4fdd\\u5b58\\u4e3a\\u56fe\\u7247\",\n",
       "                \"pixelRatio\": 1\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u8fd8\\u539f\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u6570\\u636e\\u89c6\\u56fe\",\n",
       "                \"readOnly\": false,\n",
       "                \"lang\": [\n",
       "                    \"\\u6570\\u636e\\u89c6\\u56fe\",\n",
       "                    \"\\u5173\\u95ed\",\n",
       "                    \"\\u5237\\u65b0\"\n",
       "                ],\n",
       "                \"backgroundColor\": \"#fff\",\n",
       "                \"textareaColor\": \"#fff\",\n",
       "                \"textareaBorderColor\": \"#333\",\n",
       "                \"textColor\": \"#000\",\n",
       "                \"buttonColor\": \"#c23531\",\n",
       "                \"buttonTextColor\": \"#fff\"\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"\\u533a\\u57df\\u7f29\\u653e\",\n",
       "                    \"back\": \"\\u533a\\u57df\\u7f29\\u653e\\u8fd8\\u539f\"\n",
       "                },\n",
       "                \"icon\": {},\n",
       "                \"xAxisIndex\": false,\n",
       "                \"yAxisIndex\": false,\n",
       "                \"filterMode\": \"filter\"\n",
       "            },\n",
       "            \"magicType\": {\n",
       "                \"show\": true,\n",
       "                \"type\": [\n",
       "                    \"line\",\n",
       "                    \"bar\",\n",
       "                    \"stack\",\n",
       "                    \"tiled\"\n",
       "                ],\n",
       "                \"title\": {\n",
       "                    \"line\": \"\\u5207\\u6362\\u4e3a\\u6298\\u7ebf\\u56fe\",\n",
       "                    \"bar\": \"\\u5207\\u6362\\u4e3a\\u67f1\\u72b6\\u56fe\",\n",
       "                    \"stack\": \"\\u5207\\u6362\\u4e3a\\u5806\\u53e0\",\n",
       "                    \"tiled\": \"\\u5207\\u6362\\u4e3a\\u5e73\\u94fa\"\n",
       "                },\n",
       "                \"icon\": {}\n",
       "            },\n",
       "            \"brush\": {\n",
       "                \"icon\": {},\n",
       "                \"title\": {\n",
       "                    \"rect\": \"\\u77e9\\u5f62\\u9009\\u62e9\",\n",
       "                    \"polygon\": \"\\u5708\\u9009\",\n",
       "                    \"lineX\": \"\\u6a2a\\u5411\\u9009\\u62e9\",\n",
       "                    \"lineY\": \"\\u7eb5\\u5411\\u9009\\u62e9\",\n",
       "                    \"keep\": \"\\u4fdd\\u6301\\u9009\\u62e9\",\n",
       "                    \"clear\": \"\\u6e05\\u9664\\u9009\\u62e9\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"dataZoom\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"type\": \"slider\",\n",
       "            \"realtime\": true,\n",
       "            \"start\": 0,\n",
       "            \"end\": 100,\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"zoomLock\": false,\n",
       "            \"filterMode\": \"filter\"\n",
       "        },\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"type\": \"slider\",\n",
       "            \"realtime\": true,\n",
       "            \"start\": 60,\n",
       "            \"end\": 100,\n",
       "            \"orient\": \"vertical\",\n",
       "            \"zoomLock\": false,\n",
       "            \"filterMode\": \"filter\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_f6ad290a34fe4f2d9477872340685481.setOption(option_f6ad290a34fe4f2d9477872340685481);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x29e173b3a90>"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(\n",
    "    Line(init_opts=opts.InitOpts(theme=ThemeType.CHALK))\n",
    "    .add_xaxis(xaxis_data = df_daily['event_date'].dt.strftime('%Y-%m-%d').tolist())\n",
    "    .add_yaxis(\"\", df_daily['freq'].tolist())\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"每天航班量\"),\n",
    "        toolbox_opts=opts.ToolboxOpts(), # 工具箱\n",
    "        datazoom_opts=[opts.DataZoomOpts(is_realtime=True, range_start=0, range_end=100), \n",
    "                       opts.DataZoomOpts(orient=\"vertical\", range_start=60, range_end=100)], # 同时添加水平和垂直滑动条\n",
    "    )\n",
    "    .render_notebook()\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "拖动水平滑动条可以看出，航班数量存在显著的weekly特征。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x</th>\n",
       "      <th>event_date</th>\n",
       "      <th>y</th>\n",
       "      <th>weekday</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-07</td>\n",
       "      <td>933</td>\n",
       "      <td>周一</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-14</td>\n",
       "      <td>928</td>\n",
       "      <td>周一</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-21</td>\n",
       "      <td>912</td>\n",
       "      <td>周一</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-28</td>\n",
       "      <td>923</td>\n",
       "      <td>周一</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-02-04</td>\n",
       "      <td>932</td>\n",
       "      <td>周一</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   x event_date    y weekday\n",
       "0  0 2013-01-07  933      周一\n",
       "1  0 2013-01-14  928      周一\n",
       "2  0 2013-01-21  912      周一\n",
       "3  0 2013-01-28  923      周一\n",
       "4  0 2013-02-04  932      周一"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "weekday_df = pd.DataFrame(\n",
    "    {\n",
    "        'x': [0, 1, 2, 3, 4, 5, 6],\n",
    "        'weekday': ['周一', '周二', '周三', '周四', '周五', '周六', '周日']\n",
    "    }\n",
    ").set_index('x')\n",
    "\n",
    "df_daily2 = (df_daily.eval(\"x = event_date.dt.weekday\", engine='python')\n",
    "             .rename({'freq': 'y'}, axis=1)\n",
    "             .set_index('x')\n",
    "             .join(weekday_df, how='left')\n",
    "             .reset_index()\n",
    "            )\n",
    "# 设置因子水平\n",
    "df_daily2['weekday'] = (df_daily2['weekday'].astype('category')\n",
    "                        .cat.set_categories(['周一', '周二', '周三', '周四', '周五', '周六', '周日'], ordered=True))\n",
    "df_daily2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"FJuKko\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"weekday\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"geom\":\"boxplot\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"#4169E1\",\n",
       "\"size\":1,\n",
       "\"data\":{\n",
       "\"..middle..\":[NaN,NaN,982.5,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,965.0,NaN,NaN,NaN,NaN,NaN,NaN,973.5,NaN,NaN,NaN,NaN,NaN,983.0,NaN,NaN,NaN,NaN,NaN,980.5,747.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,907.5],\n",
       "\"..lower..\":[NaN,NaN,965.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,949.0,NaN,NaN,NaN,NaN,NaN,NaN,955.0,NaN,NaN,NaN,NaN,NaN,966.0,NaN,NaN,NaN,NaN,NaN,966.0,689.5,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,891.5],\n",
       "\"..upper..\":[NaN,NaN,992.5,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,975.0,NaN,NaN,NaN,NaN,NaN,NaN,984.0,NaN,NaN,NaN,NaN,NaN,993.0,NaN,NaN,NaN,NaN,NaN,993.0,779.5,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,916.0],\n",
       "\"..ymin..\":[NaN,NaN,928.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,938.0,NaN,NaN,NaN,NaN,NaN,NaN,918.0,NaN,NaN,NaN,NaN,NaN,927.0,NaN,NaN,NaN,NaN,NaN,926.0,674.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,875.0],\n",
       "\"..ymax..\":[NaN,NaN,1004.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,1001.0,NaN,NaN,NaN,NaN,NaN,NaN,1014.0,NaN,NaN,NaN,NaN,NaN,1006.0,NaN,NaN,NaN,NaN,NaN,1002.0,857.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,934.0],\n",
       "\"weekday\":[\"周一\",\"周一\",\"周一\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周六\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\"],\n",
       "\"y\":[912.0,923.0,NaN,842.0,899.0,894.0,890.0,890.0,896.0,893.0,761.0,776.0,NaN,902.0,901.0,897.0,900.0,901.0,719.0,NaN,914.0,925.0,737.0,922.0,634.0,NaN,915.0,924.0,922.0,822.0,661.0,NaN,NaN,832.0,828.0,786.0,823.0,814.0,829.0,848.0,729.0,718.0,987.0,NaN]\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"FJuKko\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e18087c40>"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily2, aes(x='weekday', y='y')) \\\n",
    "+ geom_boxplot(color='#4169E1', size=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "&emsp;&emsp;从上图可以看出，周末的航班更少，尤其是周六，因为大多数航班都是飞行计划都是基于商务的，周末都休息了。 周日回升是因为很多人会登机去参加周一的会议。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 回归\n",
    "&emsp;&emsp;虽然时间序列可以看作是趋势项，周期项和误差项的组合，但并不代表时间序列数据就只能使用时间序列模型，同样可以使用线性回归，尤其是对于没有明显趋势项的数据集，没有趋势项，没有滞后性，使用线性回归可能效果更好。\n",
    "接下来我们拟合模型, 并在原数据基础上绘制预测图。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                 Generalized Linear Model Regression Results                  \n",
      "==============================================================================\n",
      "Dep. Variable:                      y   No. Observations:                  365\n",
      "Model:                            GLM   Df Residuals:                      358\n",
      "Model Family:                Gaussian   Df Model:                            6\n",
      "Link Function:               identity   Scale:                          2381.1\n",
      "Method:                          IRLS   Log-Likelihood:                -1933.4\n",
      "Date:                Tue, 09 Nov 2021   Deviance:                   8.5244e+05\n",
      "Time:                        15:38:49   Pearson chi2:                 8.52e+05\n",
      "No. Iterations:                     3   Pseudo R-squ. (CS):             0.9175\n",
      "Covariance Type:            nonrobust                                         \n",
      "=================================================================================\n",
      "                    coef    std err          z      P>|z|      [0.025      0.975]\n",
      "---------------------------------------------------------------------------------\n",
      "Intercept       974.8077      6.767    144.056      0.000     961.545     988.071\n",
      "weekday[T.周二]   -23.4492      9.525     -2.462      0.014     -42.117      -4.781\n",
      "weekday[T.周三]   -12.1154      9.570     -1.266      0.206     -30.872       6.641\n",
      "weekday[T.周四]    -9.0577      9.570     -0.946      0.344     -27.814       9.699\n",
      "weekday[T.周五]    -7.3462      9.570     -0.768      0.443     -26.103      11.410\n",
      "weekday[T.周六]  -230.1923      9.570    -24.054      0.000    -248.949    -211.436\n",
      "weekday[T.周日]   -83.3269      9.570     -8.707      0.000    -102.083     -64.570\n",
      "=================================================================================\n"
     ]
    }
   ],
   "source": [
    "# mod1 = smf.ols('y ~ I(x^2)', data=df_daily2).fit()\n",
    "mod1 = smf.glm('y ~ weekday', data=df_daily2).fit()\n",
    "print(mod1.summary())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x</th>\n",
       "      <th>event_date</th>\n",
       "      <th>y</th>\n",
       "      <th>weekday</th>\n",
       "      <th>pred</th>\n",
       "      <th>resid</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-07</td>\n",
       "      <td>933</td>\n",
       "      <td>周一</td>\n",
       "      <td>974.807692</td>\n",
       "      <td>-41.807692</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-14</td>\n",
       "      <td>928</td>\n",
       "      <td>周一</td>\n",
       "      <td>974.807692</td>\n",
       "      <td>-46.807692</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-21</td>\n",
       "      <td>912</td>\n",
       "      <td>周一</td>\n",
       "      <td>974.807692</td>\n",
       "      <td>-62.807692</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-28</td>\n",
       "      <td>923</td>\n",
       "      <td>周一</td>\n",
       "      <td>974.807692</td>\n",
       "      <td>-51.807692</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-02-04</td>\n",
       "      <td>932</td>\n",
       "      <td>周一</td>\n",
       "      <td>974.807692</td>\n",
       "      <td>-42.807692</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   x event_date    y weekday        pred      resid\n",
       "0  0 2013-01-07  933      周一  974.807692 -41.807692\n",
       "1  0 2013-01-14  928      周一  974.807692 -46.807692\n",
       "2  0 2013-01-21  912      周一  974.807692 -62.807692\n",
       "3  0 2013-01-28  923      周一  974.807692 -51.807692\n",
       "4  0 2013-02-04  932      周一  974.807692 -42.807692"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_daily3 = df_daily2.copy()\n",
    "df_daily3['pred'] = mod1.fittedvalues # 预测值\n",
    "df_daily3['resid'] = mod1.resid_deviance # 残差\n",
    "df_daily3.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"2H7l45\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"weekday\":[\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\"],\n",
       "\"pred\":[974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,974.8076923076924,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,951.3584905660385,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,962.6923076923088,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,965.7499999999999,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,967.4615384615375,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,744.6153846153835,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694,891.4807692307694]\n",
       "},\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"geom\":\"boxplot\",\n",
       "\"mapping\":{\n",
       "\"x\":\"weekday\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"#4169E1\",\n",
       "\"size\":1,\n",
       "\"data\":{\n",
       "\"..middle..\":[NaN,NaN,982.5,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,965.0,NaN,NaN,NaN,NaN,NaN,NaN,973.5,NaN,NaN,NaN,NaN,NaN,983.0,NaN,NaN,NaN,NaN,NaN,980.5,747.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,907.5],\n",
       "\"..lower..\":[NaN,NaN,965.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,949.0,NaN,NaN,NaN,NaN,NaN,NaN,955.0,NaN,NaN,NaN,NaN,NaN,966.0,NaN,NaN,NaN,NaN,NaN,966.0,689.5,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,891.5],\n",
       "\"..upper..\":[NaN,NaN,992.5,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,975.0,NaN,NaN,NaN,NaN,NaN,NaN,984.0,NaN,NaN,NaN,NaN,NaN,993.0,NaN,NaN,NaN,NaN,NaN,993.0,779.5,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,916.0],\n",
       "\"..ymin..\":[NaN,NaN,928.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,938.0,NaN,NaN,NaN,NaN,NaN,NaN,918.0,NaN,NaN,NaN,NaN,NaN,927.0,NaN,NaN,NaN,NaN,NaN,926.0,674.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,875.0],\n",
       "\"..ymax..\":[NaN,NaN,1004.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,1001.0,NaN,NaN,NaN,NaN,NaN,NaN,1014.0,NaN,NaN,NaN,NaN,NaN,1006.0,NaN,NaN,NaN,NaN,NaN,1002.0,857.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,934.0],\n",
       "\"weekday\":[\"周一\",\"周一\",\"周一\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周六\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\"],\n",
       "\"y\":[912.0,923.0,NaN,842.0,899.0,894.0,890.0,890.0,896.0,893.0,761.0,776.0,NaN,902.0,901.0,897.0,900.0,901.0,719.0,NaN,914.0,925.0,737.0,922.0,634.0,NaN,915.0,924.0,922.0,822.0,661.0,NaN,NaN,832.0,828.0,786.0,823.0,814.0,829.0,848.0,729.0,718.0,987.0,NaN]\n",
       "}\n",
       "},{\n",
       "\"geom\":\"point\",\n",
       "\"mapping\":{\n",
       "\"x\":\"weekday\",\n",
       "\"y\":\"pred\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"#FF00FF\",\n",
       "\"size\":3,\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"2H7l45\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e1802b760>"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily3) \\\n",
    "+ geom_boxplot(aes(x='weekday', y='y'), color='#4169E1', size=1) \\\n",
    "+ geom_point(aes(x='weekday', y='pred'), color='#FF00FF', size=3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "从上图可以看出，大部分预测值都低于平均数，这表明还存在其它影响因子。 接下来计算并可视化残差。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 残差分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'chalk':'https://assets.pyecharts.org/assets/themes/chalk'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"79b30af9fcc54d448797be931efec5fc\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'chalk'], function(echarts) {\n",
       "                var chart_79b30af9fcc54d448797be931efec5fc = echarts.init(\n",
       "                    document.getElementById('79b30af9fcc54d448797be931efec5fc'), 'chalk', {renderer: 'canvas'});\n",
       "                var option_79b30af9fcc54d448797be931efec5fc = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"2013-01-07\",\n",
       "                    -41.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-14\",\n",
       "                    -46.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-21\",\n",
       "                    -62.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-28\",\n",
       "                    -51.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-04\",\n",
       "                    -42.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-11\",\n",
       "                    -45.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-18\",\n",
       "                    -26.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-25\",\n",
       "                    -13.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-04\",\n",
       "                    2.1923076923076223\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-11\",\n",
       "                    5.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-18\",\n",
       "                    6.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-25\",\n",
       "                    3.1923076923076223\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-01\",\n",
       "                    -4.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-08\",\n",
       "                    6.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-15\",\n",
       "                    20.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-22\",\n",
       "                    10.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-29\",\n",
       "                    8.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-06\",\n",
       "                    5.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-13\",\n",
       "                    4.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-20\",\n",
       "                    8.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-27\",\n",
       "                    -46.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-03\",\n",
       "                    7.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-10\",\n",
       "                    12.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-17\",\n",
       "                    15.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-24\",\n",
       "                    19.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-01\",\n",
       "                    -8.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-08\",\n",
       "                    29.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-15\",\n",
       "                    24.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-22\",\n",
       "                    25.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-29\",\n",
       "                    24.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-05\",\n",
       "                    25.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-12\",\n",
       "                    26.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-19\",\n",
       "                    21.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-26\",\n",
       "                    7.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-02\",\n",
       "                    -45.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-09\",\n",
       "                    16.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-16\",\n",
       "                    17.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-23\",\n",
       "                    18.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-30\",\n",
       "                    18.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-07\",\n",
       "                    19.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-14\",\n",
       "                    12.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-21\",\n",
       "                    16.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-28\",\n",
       "                    8.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-04\",\n",
       "                    3.1923076923076223\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-11\",\n",
       "                    8.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-18\",\n",
       "                    10.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-25\",\n",
       "                    -32.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-02\",\n",
       "                    29.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-09\",\n",
       "                    -12.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-16\",\n",
       "                    -10.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-23\",\n",
       "                    10.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-30\",\n",
       "                    -6.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-01\",\n",
       "                    -109.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-08\",\n",
       "                    -52.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-15\",\n",
       "                    -57.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-22\",\n",
       "                    -61.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-29\",\n",
       "                    -61.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-05\",\n",
       "                    -55.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-12\",\n",
       "                    -58.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-19\",\n",
       "                    -8.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-26\",\n",
       "                    -13.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-05\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-12\",\n",
       "                    14.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-19\",\n",
       "                    15.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-26\",\n",
       "                    21.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-02\",\n",
       "                    31.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-09\",\n",
       "                    23.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-16\",\n",
       "                    22.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-23\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-30\",\n",
       "                    8.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-07\",\n",
       "                    3.6415094339614598\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-14\",\n",
       "                    3.6415094339614598\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-21\",\n",
       "                    10.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-28\",\n",
       "                    29.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-04\",\n",
       "                    8.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-11\",\n",
       "                    28.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-18\",\n",
       "                    30.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-25\",\n",
       "                    41.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-02\",\n",
       "                    -6.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-09\",\n",
       "                    49.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-16\",\n",
       "                    44.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-23\",\n",
       "                    45.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-30\",\n",
       "                    45.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-06\",\n",
       "                    44.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-13\",\n",
       "                    43.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-20\",\n",
       "                    34.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-27\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-03\",\n",
       "                    4.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-10\",\n",
       "                    9.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-17\",\n",
       "                    9.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-24\",\n",
       "                    8.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-01\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-08\",\n",
       "                    12.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-15\",\n",
       "                    11.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-22\",\n",
       "                    12.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-29\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-05\",\n",
       "                    15.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-12\",\n",
       "                    21.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-19\",\n",
       "                    21.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-26\",\n",
       "                    37.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-03\",\n",
       "                    21.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-10\",\n",
       "                    -8.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-17\",\n",
       "                    -2.3584905660385402\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-24\",\n",
       "                    -190.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-31\",\n",
       "                    -175.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-02\",\n",
       "                    -19.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-09\",\n",
       "                    -60.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-16\",\n",
       "                    -61.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-23\",\n",
       "                    -65.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-30\",\n",
       "                    -62.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-06\",\n",
       "                    -61.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-13\",\n",
       "                    -44.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-20\",\n",
       "                    -13.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-27\",\n",
       "                    -17.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-06\",\n",
       "                    9.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-13\",\n",
       "                    11.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-20\",\n",
       "                    7.307692307691241\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-27\",\n",
       "                    14.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-03\",\n",
       "                    29.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-10\",\n",
       "                    26.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-17\",\n",
       "                    25.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-24\",\n",
       "                    13.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-01\",\n",
       "                    1.3076923076912408\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-08\",\n",
       "                    2.307692307691241\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-15\",\n",
       "                    4.307692307691241\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-22\",\n",
       "                    9.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-29\",\n",
       "                    11.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-05\",\n",
       "                    7.307692307691241\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-12\",\n",
       "                    20.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-19\",\n",
       "                    22.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-26\",\n",
       "                    32.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-03\",\n",
       "                    20.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-10\",\n",
       "                    41.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-17\",\n",
       "                    38.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-24\",\n",
       "                    37.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-31\",\n",
       "                    38.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-07\",\n",
       "                    38.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-14\",\n",
       "                    34.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-21\",\n",
       "                    27.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-28\",\n",
       "                    10.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-04\",\n",
       "                    -14.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-11\",\n",
       "                    -15.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-18\",\n",
       "                    9.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-25\",\n",
       "                    13.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-02\",\n",
       "                    12.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-09\",\n",
       "                    11.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-16\",\n",
       "                    11.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-23\",\n",
       "                    12.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-30\",\n",
       "                    10.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-06\",\n",
       "                    10.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-13\",\n",
       "                    13.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-20\",\n",
       "                    14.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-27\",\n",
       "                    51.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-04\",\n",
       "                    -4.692307692308759\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-11\",\n",
       "                    -8.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-18\",\n",
       "                    -6.692307692308759\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-25\",\n",
       "                    -243.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-03\",\n",
       "                    -51.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-10\",\n",
       "                    -33.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-17\",\n",
       "                    -38.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-24\",\n",
       "                    -40.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-31\",\n",
       "                    -37.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-07\",\n",
       "                    -33.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-14\",\n",
       "                    -9.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-21\",\n",
       "                    -4.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-28\",\n",
       "                    -1.7499999999998863\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-07\",\n",
       "                    14.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-14\",\n",
       "                    16.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-21\",\n",
       "                    14.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-28\",\n",
       "                    16.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-04\",\n",
       "                    19.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-11\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-18\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-25\",\n",
       "                    17.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-02\",\n",
       "                    17.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-09\",\n",
       "                    15.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-16\",\n",
       "                    16.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-23\",\n",
       "                    22.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-30\",\n",
       "                    23.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-06\",\n",
       "                    10.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-13\",\n",
       "                    23.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-20\",\n",
       "                    29.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-27\",\n",
       "                    29.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-04\",\n",
       "                    -228.7499999999999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-11\",\n",
       "                    40.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-18\",\n",
       "                    37.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-25\",\n",
       "                    37.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-01\",\n",
       "                    34.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-08\",\n",
       "                    35.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-15\",\n",
       "                    34.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-22\",\n",
       "                    24.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-29\",\n",
       "                    13.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-05\",\n",
       "                    3.2500000000001137\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-12\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-19\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-26\",\n",
       "                    30.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-03\",\n",
       "                    29.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-10\",\n",
       "                    28.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-17\",\n",
       "                    29.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-24\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-31\",\n",
       "                    -43.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-07\",\n",
       "                    25.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-14\",\n",
       "                    22.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-21\",\n",
       "                    34.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-28\",\n",
       "                    -331.7499999999999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-05\",\n",
       "                    3.2500000000001137\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-12\",\n",
       "                    2.2500000000001137\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-19\",\n",
       "                    8.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-26\",\n",
       "                    -29.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-04\",\n",
       "                    -52.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-11\",\n",
       "                    -37.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-18\",\n",
       "                    -43.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-25\",\n",
       "                    -45.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-01\",\n",
       "                    -41.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-08\",\n",
       "                    -37.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-15\",\n",
       "                    -13.461538461537543\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-22\",\n",
       "                    -10.461538461537543\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-01\",\n",
       "                    -9.461538461537543\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-08\",\n",
       "                    11.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-15\",\n",
       "                    11.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-22\",\n",
       "                    9.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-29\",\n",
       "                    6.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-05\",\n",
       "                    13.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-12\",\n",
       "                    21.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-19\",\n",
       "                    20.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-26\",\n",
       "                    13.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-03\",\n",
       "                    10.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-10\",\n",
       "                    10.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-17\",\n",
       "                    12.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-24\",\n",
       "                    10.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-31\",\n",
       "                    18.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-07\",\n",
       "                    7.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-14\",\n",
       "                    21.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-21\",\n",
       "                    25.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-28\",\n",
       "                    26.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-05\",\n",
       "                    -145.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-12\",\n",
       "                    34.53846153846246\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-19\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-26\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-02\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-09\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-16\",\n",
       "                    30.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-23\",\n",
       "                    21.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-30\",\n",
       "                    -2.4615384615375433\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-06\",\n",
       "                    -0.4615384615375433\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-13\",\n",
       "                    28.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-20\",\n",
       "                    26.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-27\",\n",
       "                    28.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-04\",\n",
       "                    27.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-11\",\n",
       "                    23.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-18\",\n",
       "                    25.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-25\",\n",
       "                    21.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-01\",\n",
       "                    18.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-08\",\n",
       "                    18.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-15\",\n",
       "                    17.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-22\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-29\",\n",
       "                    -306.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-06\",\n",
       "                    2.5384615384624567\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-13\",\n",
       "                    2.5384615384624567\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-20\",\n",
       "                    12.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-27\",\n",
       "                    -4.461538461537543\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-05\",\n",
       "                    -24.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-12\",\n",
       "                    -54.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-19\",\n",
       "                    -70.6153846153835\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-26\",\n",
       "                    -64.6153846153835\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-02\",\n",
       "                    -62.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-09\",\n",
       "                    -60.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-16\",\n",
       "                    -6.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-23\",\n",
       "                    -1.6153846153835048\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-02\",\n",
       "                    20.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-09\",\n",
       "                    20.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-16\",\n",
       "                    22.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-23\",\n",
       "                    22.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-30\",\n",
       "                    24.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-06\",\n",
       "                    25.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-13\",\n",
       "                    25.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-20\",\n",
       "                    21.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-27\",\n",
       "                    12.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-04\",\n",
       "                    0.38461538461649525\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-11\",\n",
       "                    -6.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-18\",\n",
       "                    4.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-25\",\n",
       "                    -16.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-01\",\n",
       "                    9.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-08\",\n",
       "                    34.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-15\",\n",
       "                    56.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-22\",\n",
       "                    67.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-29\",\n",
       "                    67.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-06\",\n",
       "                    60.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-13\",\n",
       "                    66.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-20\",\n",
       "                    65.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-27\",\n",
       "                    66.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-03\",\n",
       "                    64.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-10\",\n",
       "                    62.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-17\",\n",
       "                    35.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-24\",\n",
       "                    29.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-31\",\n",
       "                    -64.6153846153835\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-07\",\n",
       "                    -56.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-14\",\n",
       "                    -58.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-21\",\n",
       "                    -51.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-28\",\n",
       "                    -62.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-05\",\n",
       "                    -57.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-12\",\n",
       "                    -68.6153846153835\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-19\",\n",
       "                    -60.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-26\",\n",
       "                    -59.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-02\",\n",
       "                    -55.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-09\",\n",
       "                    -29.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-16\",\n",
       "                    -30.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-23\",\n",
       "                    -0.6153846153835048\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-30\",\n",
       "                    112.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-07\",\n",
       "                    -53.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-14\",\n",
       "                    -52.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-21\",\n",
       "                    66.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-28\",\n",
       "                    69.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-06\",\n",
       "                    -59.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-13\",\n",
       "                    -63.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-20\",\n",
       "                    -105.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-27\",\n",
       "                    -68.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-03\",\n",
       "                    -77.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-10\",\n",
       "                    -62.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-17\",\n",
       "                    -43.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-24\",\n",
       "                    -11.480769230769397\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-03\",\n",
       "                    21.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-10\",\n",
       "                    16.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-17\",\n",
       "                    15.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-24\",\n",
       "                    13.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-31\",\n",
       "                    5.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-07\",\n",
       "                    19.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-14\",\n",
       "                    25.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-21\",\n",
       "                    27.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-28\",\n",
       "                    21.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-05\",\n",
       "                    20.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-12\",\n",
       "                    4.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-19\",\n",
       "                    19.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-26\",\n",
       "                    -162.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-02\",\n",
       "                    19.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-09\",\n",
       "                    16.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-16\",\n",
       "                    26.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-23\",\n",
       "                    31.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-30\",\n",
       "                    26.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-07\",\n",
       "                    42.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-14\",\n",
       "                    39.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-21\",\n",
       "                    37.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-28\",\n",
       "                    38.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-04\",\n",
       "                    37.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-11\",\n",
       "                    37.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-18\",\n",
       "                    22.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-25\",\n",
       "                    11.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-01\",\n",
       "                    -173.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-08\",\n",
       "                    16.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-15\",\n",
       "                    8.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-22\",\n",
       "                    12.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-29\",\n",
       "                    22.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-06\",\n",
       "                    25.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-13\",\n",
       "                    10.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-20\",\n",
       "                    23.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-27\",\n",
       "                    18.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-03\",\n",
       "                    10.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-10\",\n",
       "                    3.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-17\",\n",
       "                    4.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-24\",\n",
       "                    4.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-01\",\n",
       "                    95.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-08\",\n",
       "                    -16.480769230769397\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-15\",\n",
       "                    -11.480769230769397\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-22\",\n",
       "                    3.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-29\",\n",
       "                    -3.480769230769397\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"2013-01-07\",\n",
       "                \"2013-01-14\",\n",
       "                \"2013-01-21\",\n",
       "                \"2013-01-28\",\n",
       "                \"2013-02-04\",\n",
       "                \"2013-02-11\",\n",
       "                \"2013-02-18\",\n",
       "                \"2013-02-25\",\n",
       "                \"2013-03-04\",\n",
       "                \"2013-03-11\",\n",
       "                \"2013-03-18\",\n",
       "                \"2013-03-25\",\n",
       "                \"2013-04-01\",\n",
       "                \"2013-04-08\",\n",
       "                \"2013-04-15\",\n",
       "                \"2013-04-22\",\n",
       "                \"2013-04-29\",\n",
       "                \"2013-05-06\",\n",
       "                \"2013-05-13\",\n",
       "                \"2013-05-20\",\n",
       "                \"2013-05-27\",\n",
       "                \"2013-06-03\",\n",
       "                \"2013-06-10\",\n",
       "                \"2013-06-17\",\n",
       "                \"2013-06-24\",\n",
       "                \"2013-07-01\",\n",
       "                \"2013-07-08\",\n",
       "                \"2013-07-15\",\n",
       "                \"2013-07-22\",\n",
       "                \"2013-07-29\",\n",
       "                \"2013-08-05\",\n",
       "                \"2013-08-12\",\n",
       "                \"2013-08-19\",\n",
       "                \"2013-08-26\",\n",
       "                \"2013-09-02\",\n",
       "                \"2013-09-09\",\n",
       "                \"2013-09-16\",\n",
       "                \"2013-09-23\",\n",
       "                \"2013-09-30\",\n",
       "                \"2013-10-07\",\n",
       "                \"2013-10-14\",\n",
       "                \"2013-10-21\",\n",
       "                \"2013-10-28\",\n",
       "                \"2013-11-04\",\n",
       "                \"2013-11-11\",\n",
       "                \"2013-11-18\",\n",
       "                \"2013-11-25\",\n",
       "                \"2013-12-02\",\n",
       "                \"2013-12-09\",\n",
       "                \"2013-12-16\",\n",
       "                \"2013-12-23\",\n",
       "                \"2013-12-30\",\n",
       "                \"2013-01-01\",\n",
       "                \"2013-01-08\",\n",
       "                \"2013-01-15\",\n",
       "                \"2013-01-22\",\n",
       "                \"2013-01-29\",\n",
       "                \"2013-02-05\",\n",
       "                \"2013-02-12\",\n",
       "                \"2013-02-19\",\n",
       "                \"2013-02-26\",\n",
       "                \"2013-03-05\",\n",
       "                \"2013-03-12\",\n",
       "                \"2013-03-19\",\n",
       "                \"2013-03-26\",\n",
       "                \"2013-04-02\",\n",
       "                \"2013-04-09\",\n",
       "                \"2013-04-16\",\n",
       "                \"2013-04-23\",\n",
       "                \"2013-04-30\",\n",
       "                \"2013-05-07\",\n",
       "                \"2013-05-14\",\n",
       "                \"2013-05-21\",\n",
       "                \"2013-05-28\",\n",
       "                \"2013-06-04\",\n",
       "                \"2013-06-11\",\n",
       "                \"2013-06-18\",\n",
       "                \"2013-06-25\",\n",
       "                \"2013-07-02\",\n",
       "                \"2013-07-09\",\n",
       "                \"2013-07-16\",\n",
       "                \"2013-07-23\",\n",
       "                \"2013-07-30\",\n",
       "                \"2013-08-06\",\n",
       "                \"2013-08-13\",\n",
       "                \"2013-08-20\",\n",
       "                \"2013-08-27\",\n",
       "                \"2013-09-03\",\n",
       "                \"2013-09-10\",\n",
       "                \"2013-09-17\",\n",
       "                \"2013-09-24\",\n",
       "                \"2013-10-01\",\n",
       "                \"2013-10-08\",\n",
       "                \"2013-10-15\",\n",
       "                \"2013-10-22\",\n",
       "                \"2013-10-29\",\n",
       "                \"2013-11-05\",\n",
       "                \"2013-11-12\",\n",
       "                \"2013-11-19\",\n",
       "                \"2013-11-26\",\n",
       "                \"2013-12-03\",\n",
       "                \"2013-12-10\",\n",
       "                \"2013-12-17\",\n",
       "                \"2013-12-24\",\n",
       "                \"2013-12-31\",\n",
       "                \"2013-01-02\",\n",
       "                \"2013-01-09\",\n",
       "                \"2013-01-16\",\n",
       "                \"2013-01-23\",\n",
       "                \"2013-01-30\",\n",
       "                \"2013-02-06\",\n",
       "                \"2013-02-13\",\n",
       "                \"2013-02-20\",\n",
       "                \"2013-02-27\",\n",
       "                \"2013-03-06\",\n",
       "                \"2013-03-13\",\n",
       "                \"2013-03-20\",\n",
       "                \"2013-03-27\",\n",
       "                \"2013-04-03\",\n",
       "                \"2013-04-10\",\n",
       "                \"2013-04-17\",\n",
       "                \"2013-04-24\",\n",
       "                \"2013-05-01\",\n",
       "                \"2013-05-08\",\n",
       "                \"2013-05-15\",\n",
       "                \"2013-05-22\",\n",
       "                \"2013-05-29\",\n",
       "                \"2013-06-05\",\n",
       "                \"2013-06-12\",\n",
       "                \"2013-06-19\",\n",
       "                \"2013-06-26\",\n",
       "                \"2013-07-03\",\n",
       "                \"2013-07-10\",\n",
       "                \"2013-07-17\",\n",
       "                \"2013-07-24\",\n",
       "                \"2013-07-31\",\n",
       "                \"2013-08-07\",\n",
       "                \"2013-08-14\",\n",
       "                \"2013-08-21\",\n",
       "                \"2013-08-28\",\n",
       "                \"2013-09-04\",\n",
       "                \"2013-09-11\",\n",
       "                \"2013-09-18\",\n",
       "                \"2013-09-25\",\n",
       "                \"2013-10-02\",\n",
       "                \"2013-10-09\",\n",
       "                \"2013-10-16\",\n",
       "                \"2013-10-23\",\n",
       "                \"2013-10-30\",\n",
       "                \"2013-11-06\",\n",
       "                \"2013-11-13\",\n",
       "                \"2013-11-20\",\n",
       "                \"2013-11-27\",\n",
       "                \"2013-12-04\",\n",
       "                \"2013-12-11\",\n",
       "                \"2013-12-18\",\n",
       "                \"2013-12-25\",\n",
       "                \"2013-01-03\",\n",
       "                \"2013-01-10\",\n",
       "                \"2013-01-17\",\n",
       "                \"2013-01-24\",\n",
       "                \"2013-01-31\",\n",
       "                \"2013-02-07\",\n",
       "                \"2013-02-14\",\n",
       "                \"2013-02-21\",\n",
       "                \"2013-02-28\",\n",
       "                \"2013-03-07\",\n",
       "                \"2013-03-14\",\n",
       "                \"2013-03-21\",\n",
       "                \"2013-03-28\",\n",
       "                \"2013-04-04\",\n",
       "                \"2013-04-11\",\n",
       "                \"2013-04-18\",\n",
       "                \"2013-04-25\",\n",
       "                \"2013-05-02\",\n",
       "                \"2013-05-09\",\n",
       "                \"2013-05-16\",\n",
       "                \"2013-05-23\",\n",
       "                \"2013-05-30\",\n",
       "                \"2013-06-06\",\n",
       "                \"2013-06-13\",\n",
       "                \"2013-06-20\",\n",
       "                \"2013-06-27\",\n",
       "                \"2013-07-04\",\n",
       "                \"2013-07-11\",\n",
       "                \"2013-07-18\",\n",
       "                \"2013-07-25\",\n",
       "                \"2013-08-01\",\n",
       "                \"2013-08-08\",\n",
       "                \"2013-08-15\",\n",
       "                \"2013-08-22\",\n",
       "                \"2013-08-29\",\n",
       "                \"2013-09-05\",\n",
       "                \"2013-09-12\",\n",
       "                \"2013-09-19\",\n",
       "                \"2013-09-26\",\n",
       "                \"2013-10-03\",\n",
       "                \"2013-10-10\",\n",
       "                \"2013-10-17\",\n",
       "                \"2013-10-24\",\n",
       "                \"2013-10-31\",\n",
       "                \"2013-11-07\",\n",
       "                \"2013-11-14\",\n",
       "                \"2013-11-21\",\n",
       "                \"2013-11-28\",\n",
       "                \"2013-12-05\",\n",
       "                \"2013-12-12\",\n",
       "                \"2013-12-19\",\n",
       "                \"2013-12-26\",\n",
       "                \"2013-01-04\",\n",
       "                \"2013-01-11\",\n",
       "                \"2013-01-18\",\n",
       "                \"2013-01-25\",\n",
       "                \"2013-02-01\",\n",
       "                \"2013-02-08\",\n",
       "                \"2013-02-15\",\n",
       "                \"2013-02-22\",\n",
       "                \"2013-03-01\",\n",
       "                \"2013-03-08\",\n",
       "                \"2013-03-15\",\n",
       "                \"2013-03-22\",\n",
       "                \"2013-03-29\",\n",
       "                \"2013-04-05\",\n",
       "                \"2013-04-12\",\n",
       "                \"2013-04-19\",\n",
       "                \"2013-04-26\",\n",
       "                \"2013-05-03\",\n",
       "                \"2013-05-10\",\n",
       "                \"2013-05-17\",\n",
       "                \"2013-05-24\",\n",
       "                \"2013-05-31\",\n",
       "                \"2013-06-07\",\n",
       "                \"2013-06-14\",\n",
       "                \"2013-06-21\",\n",
       "                \"2013-06-28\",\n",
       "                \"2013-07-05\",\n",
       "                \"2013-07-12\",\n",
       "                \"2013-07-19\",\n",
       "                \"2013-07-26\",\n",
       "                \"2013-08-02\",\n",
       "                \"2013-08-09\",\n",
       "                \"2013-08-16\",\n",
       "                \"2013-08-23\",\n",
       "                \"2013-08-30\",\n",
       "                \"2013-09-06\",\n",
       "                \"2013-09-13\",\n",
       "                \"2013-09-20\",\n",
       "                \"2013-09-27\",\n",
       "                \"2013-10-04\",\n",
       "                \"2013-10-11\",\n",
       "                \"2013-10-18\",\n",
       "                \"2013-10-25\",\n",
       "                \"2013-11-01\",\n",
       "                \"2013-11-08\",\n",
       "                \"2013-11-15\",\n",
       "                \"2013-11-22\",\n",
       "                \"2013-11-29\",\n",
       "                \"2013-12-06\",\n",
       "                \"2013-12-13\",\n",
       "                \"2013-12-20\",\n",
       "                \"2013-12-27\",\n",
       "                \"2013-01-05\",\n",
       "                \"2013-01-12\",\n",
       "                \"2013-01-19\",\n",
       "                \"2013-01-26\",\n",
       "                \"2013-02-02\",\n",
       "                \"2013-02-09\",\n",
       "                \"2013-02-16\",\n",
       "                \"2013-02-23\",\n",
       "                \"2013-03-02\",\n",
       "                \"2013-03-09\",\n",
       "                \"2013-03-16\",\n",
       "                \"2013-03-23\",\n",
       "                \"2013-03-30\",\n",
       "                \"2013-04-06\",\n",
       "                \"2013-04-13\",\n",
       "                \"2013-04-20\",\n",
       "                \"2013-04-27\",\n",
       "                \"2013-05-04\",\n",
       "                \"2013-05-11\",\n",
       "                \"2013-05-18\",\n",
       "                \"2013-05-25\",\n",
       "                \"2013-06-01\",\n",
       "                \"2013-06-08\",\n",
       "                \"2013-06-15\",\n",
       "                \"2013-06-22\",\n",
       "                \"2013-06-29\",\n",
       "                \"2013-07-06\",\n",
       "                \"2013-07-13\",\n",
       "                \"2013-07-20\",\n",
       "                \"2013-07-27\",\n",
       "                \"2013-08-03\",\n",
       "                \"2013-08-10\",\n",
       "                \"2013-08-17\",\n",
       "                \"2013-08-24\",\n",
       "                \"2013-08-31\",\n",
       "                \"2013-09-07\",\n",
       "                \"2013-09-14\",\n",
       "                \"2013-09-21\",\n",
       "                \"2013-09-28\",\n",
       "                \"2013-10-05\",\n",
       "                \"2013-10-12\",\n",
       "                \"2013-10-19\",\n",
       "                \"2013-10-26\",\n",
       "                \"2013-11-02\",\n",
       "                \"2013-11-09\",\n",
       "                \"2013-11-16\",\n",
       "                \"2013-11-23\",\n",
       "                \"2013-11-30\",\n",
       "                \"2013-12-07\",\n",
       "                \"2013-12-14\",\n",
       "                \"2013-12-21\",\n",
       "                \"2013-12-28\",\n",
       "                \"2013-01-06\",\n",
       "                \"2013-01-13\",\n",
       "                \"2013-01-20\",\n",
       "                \"2013-01-27\",\n",
       "                \"2013-02-03\",\n",
       "                \"2013-02-10\",\n",
       "                \"2013-02-17\",\n",
       "                \"2013-02-24\",\n",
       "                \"2013-03-03\",\n",
       "                \"2013-03-10\",\n",
       "                \"2013-03-17\",\n",
       "                \"2013-03-24\",\n",
       "                \"2013-03-31\",\n",
       "                \"2013-04-07\",\n",
       "                \"2013-04-14\",\n",
       "                \"2013-04-21\",\n",
       "                \"2013-04-28\",\n",
       "                \"2013-05-05\",\n",
       "                \"2013-05-12\",\n",
       "                \"2013-05-19\",\n",
       "                \"2013-05-26\",\n",
       "                \"2013-06-02\",\n",
       "                \"2013-06-09\",\n",
       "                \"2013-06-16\",\n",
       "                \"2013-06-23\",\n",
       "                \"2013-06-30\",\n",
       "                \"2013-07-07\",\n",
       "                \"2013-07-14\",\n",
       "                \"2013-07-21\",\n",
       "                \"2013-07-28\",\n",
       "                \"2013-08-04\",\n",
       "                \"2013-08-11\",\n",
       "                \"2013-08-18\",\n",
       "                \"2013-08-25\",\n",
       "                \"2013-09-01\",\n",
       "                \"2013-09-08\",\n",
       "                \"2013-09-15\",\n",
       "                \"2013-09-22\",\n",
       "                \"2013-09-29\",\n",
       "                \"2013-10-06\",\n",
       "                \"2013-10-13\",\n",
       "                \"2013-10-20\",\n",
       "                \"2013-10-27\",\n",
       "                \"2013-11-03\",\n",
       "                \"2013-11-10\",\n",
       "                \"2013-11-17\",\n",
       "                \"2013-11-24\",\n",
       "                \"2013-12-01\",\n",
       "                \"2013-12-08\",\n",
       "                \"2013-12-15\",\n",
       "                \"2013-12-22\",\n",
       "                \"2013-12-29\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6b8b\\u5dee\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"type\": \"png\",\n",
       "                \"backgroundColor\": \"auto\",\n",
       "                \"connectedBackgroundColor\": \"#fff\",\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u4fdd\\u5b58\\u4e3a\\u56fe\\u7247\",\n",
       "                \"pixelRatio\": 1\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u8fd8\\u539f\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u6570\\u636e\\u89c6\\u56fe\",\n",
       "                \"readOnly\": false,\n",
       "                \"lang\": [\n",
       "                    \"\\u6570\\u636e\\u89c6\\u56fe\",\n",
       "                    \"\\u5173\\u95ed\",\n",
       "                    \"\\u5237\\u65b0\"\n",
       "                ],\n",
       "                \"backgroundColor\": \"#fff\",\n",
       "                \"textareaColor\": \"#fff\",\n",
       "                \"textareaBorderColor\": \"#333\",\n",
       "                \"textColor\": \"#000\",\n",
       "                \"buttonColor\": \"#c23531\",\n",
       "                \"buttonTextColor\": \"#fff\"\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"\\u533a\\u57df\\u7f29\\u653e\",\n",
       "                    \"back\": \"\\u533a\\u57df\\u7f29\\u653e\\u8fd8\\u539f\"\n",
       "                },\n",
       "                \"icon\": {},\n",
       "                \"xAxisIndex\": false,\n",
       "                \"yAxisIndex\": false,\n",
       "                \"filterMode\": \"filter\"\n",
       "            },\n",
       "            \"magicType\": {\n",
       "                \"show\": true,\n",
       "                \"type\": [\n",
       "                    \"line\",\n",
       "                    \"bar\",\n",
       "                    \"stack\",\n",
       "                    \"tiled\"\n",
       "                ],\n",
       "                \"title\": {\n",
       "                    \"line\": \"\\u5207\\u6362\\u4e3a\\u6298\\u7ebf\\u56fe\",\n",
       "                    \"bar\": \"\\u5207\\u6362\\u4e3a\\u67f1\\u72b6\\u56fe\",\n",
       "                    \"stack\": \"\\u5207\\u6362\\u4e3a\\u5806\\u53e0\",\n",
       "                    \"tiled\": \"\\u5207\\u6362\\u4e3a\\u5e73\\u94fa\"\n",
       "                },\n",
       "                \"icon\": {}\n",
       "            },\n",
       "            \"brush\": {\n",
       "                \"icon\": {},\n",
       "                \"title\": {\n",
       "                    \"rect\": \"\\u77e9\\u5f62\\u9009\\u62e9\",\n",
       "                    \"polygon\": \"\\u5708\\u9009\",\n",
       "                    \"lineX\": \"\\u6a2a\\u5411\\u9009\\u62e9\",\n",
       "                    \"lineY\": \"\\u7eb5\\u5411\\u9009\\u62e9\",\n",
       "                    \"keep\": \"\\u4fdd\\u6301\\u9009\\u62e9\",\n",
       "                    \"clear\": \"\\u6e05\\u9664\\u9009\\u62e9\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"dataZoom\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"type\": \"slider\",\n",
       "            \"realtime\": true,\n",
       "            \"start\": 0,\n",
       "            \"end\": 100,\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"zoomLock\": false,\n",
       "            \"filterMode\": \"filter\"\n",
       "        },\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"type\": \"slider\",\n",
       "            \"realtime\": true,\n",
       "            \"start\": 0,\n",
       "            \"end\": 100,\n",
       "            \"orient\": \"vertical\",\n",
       "            \"zoomLock\": false,\n",
       "            \"filterMode\": \"filter\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_79b30af9fcc54d448797be931efec5fc.setOption(option_79b30af9fcc54d448797be931efec5fc);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x29e17fcdee0>"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(\n",
    "    Line(init_opts=opts.InitOpts(theme=ThemeType.CHALK))\n",
    "    .add_xaxis(xaxis_data = df_daily3['event_date'].dt.strftime('%Y-%m-%d').tolist())\n",
    "    .add_yaxis(\"\", df_daily3['resid'].tolist())\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"残差\"),\n",
    "        toolbox_opts=opts.ToolboxOpts(), # 工具箱\n",
    "        datazoom_opts=[opts.DataZoomOpts(is_realtime=True, range_start=0, range_end=100), \n",
    "                       opts.DataZoomOpts(orient=\"vertical\", range_start=0, range_end=100)], # 同时添加水平和垂直滑动条\n",
    "    )\n",
    "    .render_notebook()\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"mIWMLq\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"event_date\":[1.3575168E12,1.3581216E12,1.3587264E12,1.3593312E12,1.359936E12,1.3605408E12,1.3611456E12,1.3617504E12,1.3623552E12,1.36296E12,1.3635648E12,1.3641696E12,1.3647744E12,1.3653792E12,1.365984E12,1.3665888E12,1.3671936E12,1.3677984E12,1.3684032E12,1.369008E12,1.3696128E12,1.3702176E12,1.3708224E12,1.3714272E12,1.372032E12,1.3726368E12,1.3732416E12,1.3738464E12,1.3744512E12,1.375056E12,1.3756608E12,1.3762656E12,1.3768704E12,1.3774752E12,1.37808E12,1.3786848E12,1.3792896E12,1.3798944E12,1.3804992E12,1.381104E12,1.3817088E12,1.3823136E12,1.3829184E12,1.3835232E12,1.384128E12,1.3847328E12,1.3853376E12,1.3859424E12,1.3865472E12,1.387152E12,1.3877568E12,1.3883616E12,1.3569984E12,1.3576032E12,1.358208E12,1.3588128E12,1.3594176E12,1.3600224E12,1.3606272E12,1.361232E12,1.3618368E12,1.3624416E12,1.3630464E12,1.3636512E12,1.364256E12,1.3648608E12,1.3654656E12,1.3660704E12,1.3666752E12,1.36728E12,1.3678848E12,1.3684896E12,1.3690944E12,1.3696992E12,1.370304E12,1.3709088E12,1.3715136E12,1.3721184E12,1.3727232E12,1.373328E12,1.3739328E12,1.3745376E12,1.3751424E12,1.3757472E12,1.376352E12,1.3769568E12,1.3775616E12,1.3781664E12,1.3787712E12,1.379376E12,1.3799808E12,1.3805856E12,1.3811904E12,1.3817952E12,1.3824E12,1.3830048E12,1.3836096E12,1.3842144E12,1.3848192E12,1.385424E12,1.3860288E12,1.3866336E12,1.3872384E12,1.3878432E12,1.388448E12,1.3570848E12,1.3576896E12,1.3582944E12,1.3588992E12,1.359504E12,1.3601088E12,1.3607136E12,1.3613184E12,1.3619232E12,1.362528E12,1.3631328E12,1.3637376E12,1.3643424E12,1.3649472E12,1.365552E12,1.3661568E12,1.3667616E12,1.3673664E12,1.3679712E12,1.368576E12,1.3691808E12,1.3697856E12,1.3703904E12,1.3709952E12,1.3716E12,1.3722048E12,1.3728096E12,1.3734144E12,1.3740192E12,1.374624E12,1.3752288E12,1.3758336E12,1.3764384E12,1.3770432E12,1.377648E12,1.3782528E12,1.3788576E12,1.3794624E12,1.3800672E12,1.380672E12,1.3812768E12,1.3818816E12,1.3824864E12,1.3830912E12,1.383696E12,1.3843008E12,1.3849056E12,1.3855104E12,1.3861152E12,1.38672E12,1.3873248E12,1.3879296E12,1.3571712E12,1.357776E12,1.3583808E12,1.3589856E12,1.3595904E12,1.3601952E12,1.3608E12,1.3614048E12,1.3620096E12,1.3626144E12,1.3632192E12,1.363824E12,1.3644288E12,1.3650336E12,1.3656384E12,1.3662432E12,1.366848E12,1.3674528E12,1.3680576E12,1.3686624E12,1.3692672E12,1.369872E12,1.3704768E12,1.3710816E12,1.3716864E12,1.3722912E12,1.372896E12,1.3735008E12,1.3741056E12,1.3747104E12,1.3753152E12,1.37592E12,1.3765248E12,1.3771296E12,1.3777344E12,1.3783392E12,1.378944E12,1.3795488E12,1.3801536E12,1.3807584E12,1.3813632E12,1.381968E12,1.3825728E12,1.3831776E12,1.3837824E12,1.3843872E12,1.384992E12,1.3855968E12,1.3862016E12,1.3868064E12,1.3874112E12,1.388016E12,1.3572576E12,1.3578624E12,1.3584672E12,1.359072E12,1.3596768E12,1.3602816E12,1.3608864E12,1.3614912E12,1.362096E12,1.3627008E12,1.3633056E12,1.3639104E12,1.3645152E12,1.36512E12,1.3657248E12,1.3663296E12,1.3669344E12,1.3675392E12,1.368144E12,1.3687488E12,1.3693536E12,1.3699584E12,1.3705632E12,1.371168E12,1.3717728E12,1.3723776E12,1.3729824E12,1.3735872E12,1.374192E12,1.3747968E12,1.3754016E12,1.3760064E12,1.3766112E12,1.377216E12,1.3778208E12,1.3784256E12,1.3790304E12,1.3796352E12,1.38024E12,1.3808448E12,1.3814496E12,1.3820544E12,1.3826592E12,1.383264E12,1.3838688E12,1.3844736E12,1.3850784E12,1.3856832E12,1.386288E12,1.3868928E12,1.3874976E12,1.3881024E12,1.357344E12,1.3579488E12,1.3585536E12,1.3591584E12,1.3597632E12,1.360368E12,1.3609728E12,1.3615776E12,1.3621824E12,1.3627872E12,1.363392E12,1.3639968E12,1.3646016E12,1.3652064E12,1.3658112E12,1.366416E12,1.3670208E12,1.3676256E12,1.3682304E12,1.3688352E12,1.36944E12,1.3700448E12,1.3706496E12,1.3712544E12,1.3718592E12,1.372464E12,1.3730688E12,1.3736736E12,1.3742784E12,1.3748832E12,1.375488E12,1.3760928E12,1.3766976E12,1.3773024E12,1.3779072E12,1.378512E12,1.3791168E12,1.3797216E12,1.3803264E12,1.3809312E12,1.381536E12,1.3821408E12,1.3827456E12,1.3833504E12,1.3839552E12,1.38456E12,1.3851648E12,1.3857696E12,1.3863744E12,1.3869792E12,1.387584E12,1.3881888E12,1.3574304E12,1.3580352E12,1.35864E12,1.3592448E12,1.3598496E12,1.3604544E12,1.3610592E12,1.361664E12,1.3622688E12,1.3628736E12,1.3634784E12,1.3640832E12,1.364688E12,1.3652928E12,1.3658976E12,1.3665024E12,1.3671072E12,1.367712E12,1.3683168E12,1.3689216E12,1.3695264E12,1.3701312E12,1.370736E12,1.3713408E12,1.3719456E12,1.3725504E12,1.3731552E12,1.37376E12,1.3743648E12,1.3749696E12,1.3755744E12,1.3761792E12,1.376784E12,1.3773888E12,1.3779936E12,1.3785984E12,1.3792032E12,1.379808E12,1.3804128E12,1.3810176E12,1.3816224E12,1.3822272E12,1.382832E12,1.3834368E12,1.3840416E12,1.3846464E12,1.3852512E12,1.385856E12,1.3864608E12,1.3870656E12,1.3876704E12,1.3882752E12],\n",
       "\"weekday\":[\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\"],\n",
       "\"resid\":[-41.80769230769238,-46.80769230769238,-62.80769230769238,-51.80769230769238,-42.80769230769238,-45.80769230769238,-26.807692307692378,-13.807692307692378,2.1923076923076223,5.192307692307622,6.192307692307622,3.1923076923076223,-4.807692307692378,6.192307692307622,20.192307692307622,10.192307692307622,8.192307692307622,5.192307692307622,4.192307692307622,8.192307692307622,-46.80769230769238,7.192307692307622,12.192307692307622,15.192307692307622,19.192307692307622,-8.807692307692378,29.192307692307622,24.192307692307622,25.192307692307622,24.192307692307622,25.192307692307622,26.192307692307622,21.192307692307622,7.192307692307622,-45.80769230769238,16.192307692307622,17.192307692307622,18.192307692307622,18.192307692307622,19.192307692307622,12.192307692307622,16.192307692307622,8.192307692307622,3.1923076923076223,8.192307692307622,10.192307692307622,-32.80769230769238,29.192307692307622,-12.807692307692378,-10.807692307692378,10.192307692307622,-6.807692307692378,-109.35849056603854,-52.35849056603854,-57.35849056603854,-61.35849056603854,-61.35849056603854,-55.35849056603854,-58.35849056603854,-8.35849056603854,-13.35849056603854,13.64150943396146,14.64150943396146,15.64150943396146,21.64150943396146,31.64150943396146,23.64150943396146,22.64150943396146,13.64150943396146,8.64150943396146,3.6415094339614598,3.6415094339614598,10.64150943396146,29.64150943396146,8.64150943396146,28.64150943396146,30.64150943396146,41.64150943396146,-6.35849056603854,49.64150943396146,44.64150943396146,45.64150943396146,45.64150943396146,44.64150943396146,43.64150943396146,34.64150943396146,13.64150943396146,4.64150943396146,9.64150943396146,9.64150943396146,8.64150943396146,13.64150943396146,12.64150943396146,11.64150943396146,12.64150943396146,13.64150943396146,15.64150943396146,21.64150943396146,21.64150943396146,37.64150943396146,21.64150943396146,-8.35849056603854,-2.3584905660385402,-190.35849056603854,-175.35849056603854,-19.69230769230876,-60.69230769230876,-61.69230769230876,-65.69230769230876,-62.69230769230876,-61.69230769230876,-44.69230769230876,-13.69230769230876,-17.69230769230876,9.30769230769124,11.30769230769124,7.307692307691241,14.30769230769124,29.30769230769124,26.30769230769124,25.30769230769124,13.30769230769124,1.3076923076912408,2.307692307691241,4.307692307691241,9.30769230769124,11.30769230769124,7.307692307691241,20.30769230769124,22.30769230769124,32.30769230769124,20.30769230769124,41.30769230769124,38.30769230769124,37.30769230769124,38.30769230769124,38.30769230769124,34.30769230769124,27.30769230769124,10.30769230769124,-14.69230769230876,-15.69230769230876,9.30769230769124,13.30769230769124,12.30769230769124,11.30769230769124,11.30769230769124,12.30769230769124,10.30769230769124,10.30769230769124,13.30769230769124,14.30769230769124,51.30769230769124,-4.692307692308759,-8.69230769230876,-6.692307692308759,-243.69230769230876,-51.749999999999886,-33.749999999999886,-38.749999999999886,-40.749999999999886,-37.749999999999886,-33.749999999999886,-9.749999999999886,-4.749999999999886,-1.7499999999998863,14.250000000000114,16.250000000000114,14.250000000000114,16.250000000000114,19.250000000000114,26.250000000000114,26.250000000000114,17.250000000000114,17.250000000000114,15.250000000000114,16.250000000000114,22.250000000000114,23.250000000000114,10.250000000000114,23.250000000000114,29.250000000000114,29.250000000000114,-228.7499999999999,40.250000000000114,37.250000000000114,37.250000000000114,34.250000000000114,35.250000000000114,34.250000000000114,24.250000000000114,13.250000000000114,3.2500000000001137,26.250000000000114,26.250000000000114,30.250000000000114,29.250000000000114,28.250000000000114,29.250000000000114,26.250000000000114,-43.749999999999886,25.250000000000114,22.250000000000114,34.250000000000114,-331.7499999999999,3.2500000000001137,2.2500000000001137,8.250000000000114,-29.749999999999886,-52.46153846153754,-37.46153846153754,-43.46153846153754,-45.46153846153754,-41.46153846153754,-37.46153846153754,-13.461538461537543,-10.461538461537543,-9.461538461537543,11.538461538462457,11.538461538462457,9.538461538462457,6.538461538462457,13.538461538462457,21.538461538462457,20.538461538462457,13.538461538462457,10.538461538462457,10.538461538462457,12.538461538462457,10.538461538462457,18.538461538462457,7.538461538462457,21.538461538462457,25.538461538462457,26.538461538462457,-145.46153846153754,34.53846153846246,31.538461538462457,31.538461538462457,31.538461538462457,31.538461538462457,30.538461538462457,21.538461538462457,-2.4615384615375433,-0.4615384615375433,28.538461538462457,26.538461538462457,28.538461538462457,27.538461538462457,23.538461538462457,25.538461538462457,21.538461538462457,18.538461538462457,18.538461538462457,17.538461538462457,31.538461538462457,-306.46153846153754,2.5384615384624567,2.5384615384624567,12.538461538462457,-4.461538461537543,-24.615384615383505,-54.615384615383505,-70.6153846153835,-64.6153846153835,-62.615384615383505,-60.615384615383505,-6.615384615383505,-1.6153846153835048,20.384615384616495,20.384615384616495,22.384615384616495,22.384615384616495,24.384615384616495,25.384615384616495,25.384615384616495,21.384615384616495,12.384615384616495,0.38461538461649525,-6.615384615383505,4.384615384616495,-16.615384615383505,9.384615384616495,34.384615384616495,56.384615384616495,67.3846153846165,67.3846153846165,60.384615384616495,66.3846153846165,65.3846153846165,66.3846153846165,64.3846153846165,62.384615384616495,35.384615384616495,29.384615384616495,-64.6153846153835,-56.615384615383505,-58.615384615383505,-51.615384615383505,-62.615384615383505,-57.615384615383505,-68.6153846153835,-60.615384615383505,-59.615384615383505,-55.615384615383505,-29.615384615383505,-30.615384615383505,-0.6153846153835048,112.3846153846165,-53.615384615383505,-52.615384615383505,66.3846153846165,69.3846153846165,-59.4807692307694,-63.4807692307694,-105.4807692307694,-68.4807692307694,-77.4807692307694,-62.4807692307694,-43.4807692307694,-11.480769230769397,21.519230769230603,16.519230769230603,15.519230769230603,13.519230769230603,5.519230769230603,19.519230769230603,25.519230769230603,27.519230769230603,21.519230769230603,20.519230769230603,4.519230769230603,19.519230769230603,-162.4807692307694,19.519230769230603,16.519230769230603,26.519230769230603,31.519230769230603,26.519230769230603,42.5192307692306,39.5192307692306,37.5192307692306,38.5192307692306,37.5192307692306,37.5192307692306,22.519230769230603,11.519230769230603,-173.4807692307694,16.519230769230603,8.519230769230603,12.519230769230603,22.519230769230603,25.519230769230603,10.519230769230603,23.519230769230603,18.519230769230603,10.519230769230603,3.519230769230603,4.519230769230603,4.519230769230603,95.5192307692306,-16.480769230769397,-11.480769230769397,3.519230769230603,-3.480769230769397]\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"resid\",\n",
       "\"group\":\"weekday\",\n",
       "\"color\":\"weekday\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":800,\n",
       "\"height\":400\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"color\",\n",
       "\"palette\":\"Set2\",\n",
       "\"scale_mapper_kind\":\"color_brewer\"\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"format\":\"%Y-%m-%d\",\n",
       "\"datetime\":true\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"size\":1,\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"mIWMLq\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e18081640>"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily3, aes(x='event_date', y='resid', group='weekday', color='weekday')) \\\n",
    "+ geom_line(size=1) \\\n",
    "+ scale_color_brewer(palette='Set2') \\\n",
    "+ scale_x_datetime(format='%Y-%m-%d') \\\n",
    "+ ggsize(800, 400) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "夏天残差为负数，表明夏天预测值比实际值高太多，模型表现并不好，而秋天稍微好些， 下面优化模型，提高预测精度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1, 6)"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x</th>\n",
       "      <th>event_date</th>\n",
       "      <th>y</th>\n",
       "      <th>weekday</th>\n",
       "      <th>pred</th>\n",
       "      <th>resid</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>308</th>\n",
       "      <td>5</td>\n",
       "      <td>2013-11-30</td>\n",
       "      <td>857</td>\n",
       "      <td>周六</td>\n",
       "      <td>744.615385</td>\n",
       "      <td>112.384615</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     x event_date    y weekday        pred       resid\n",
       "308  5 2013-11-30  857      周六  744.615385  112.384615"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "exception_df = df_daily3.query(\"resid > 100\")\n",
    "exception_df.shape\n",
    "exception_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "&emsp;&emsp;熟悉美国节日的应该知道几个重要节日：新年、7月4日国庆节， 11月第4个星期四为感恩节，12月25日圣诞节。结合上图可以发现节假日期间航班量残差陡增，即航班量暴跌。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"qLxVdM\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"event_date\":[1.3575168E12,1.3581216E12,1.3587264E12,1.3593312E12,1.359936E12,1.3605408E12,1.3611456E12,1.3617504E12,1.3623552E12,1.36296E12,1.3635648E12,1.3641696E12,1.3647744E12,1.3653792E12,1.365984E12,1.3665888E12,1.3671936E12,1.3677984E12,1.3684032E12,1.369008E12,1.3696128E12,1.3702176E12,1.3708224E12,1.3714272E12,1.372032E12,1.3726368E12,1.3732416E12,1.3738464E12,1.3744512E12,1.375056E12,1.3756608E12,1.3762656E12,1.3768704E12,1.3774752E12,1.37808E12,1.3786848E12,1.3792896E12,1.3798944E12,1.3804992E12,1.381104E12,1.3817088E12,1.3823136E12,1.3829184E12,1.3835232E12,1.384128E12,1.3847328E12,1.3853376E12,1.3859424E12,1.3865472E12,1.387152E12,1.3877568E12,1.3883616E12,1.3569984E12,1.3576032E12,1.358208E12,1.3588128E12,1.3594176E12,1.3600224E12,1.3606272E12,1.361232E12,1.3618368E12,1.3624416E12,1.3630464E12,1.3636512E12,1.364256E12,1.3648608E12,1.3654656E12,1.3660704E12,1.3666752E12,1.36728E12,1.3678848E12,1.3684896E12,1.3690944E12,1.3696992E12,1.370304E12,1.3709088E12,1.3715136E12,1.3721184E12,1.3727232E12,1.373328E12,1.3739328E12,1.3745376E12,1.3751424E12,1.3757472E12,1.376352E12,1.3769568E12,1.3775616E12,1.3781664E12,1.3787712E12,1.379376E12,1.3799808E12,1.3805856E12,1.3811904E12,1.3817952E12,1.3824E12,1.3830048E12,1.3836096E12,1.3842144E12,1.3848192E12,1.385424E12,1.3860288E12,1.3866336E12,1.3872384E12,1.3878432E12,1.388448E12,1.3570848E12,1.3576896E12,1.3582944E12,1.3588992E12,1.359504E12,1.3601088E12,1.3607136E12,1.3613184E12,1.3619232E12,1.362528E12,1.3631328E12,1.3637376E12,1.3643424E12,1.3649472E12,1.365552E12,1.3661568E12,1.3667616E12,1.3673664E12,1.3679712E12,1.368576E12,1.3691808E12,1.3697856E12,1.3703904E12,1.3709952E12,1.3716E12,1.3722048E12,1.3728096E12,1.3734144E12,1.3740192E12,1.374624E12,1.3752288E12,1.3758336E12,1.3764384E12,1.3770432E12,1.377648E12,1.3782528E12,1.3788576E12,1.3794624E12,1.3800672E12,1.380672E12,1.3812768E12,1.3818816E12,1.3824864E12,1.3830912E12,1.383696E12,1.3843008E12,1.3849056E12,1.3855104E12,1.3861152E12,1.38672E12,1.3873248E12,1.3879296E12,1.3571712E12,1.357776E12,1.3583808E12,1.3589856E12,1.3595904E12,1.3601952E12,1.3608E12,1.3614048E12,1.3620096E12,1.3626144E12,1.3632192E12,1.363824E12,1.3644288E12,1.3650336E12,1.3656384E12,1.3662432E12,1.366848E12,1.3674528E12,1.3680576E12,1.3686624E12,1.3692672E12,1.369872E12,1.3704768E12,1.3710816E12,1.3716864E12,1.3722912E12,1.372896E12,1.3735008E12,1.3741056E12,1.3747104E12,1.3753152E12,1.37592E12,1.3765248E12,1.3771296E12,1.3777344E12,1.3783392E12,1.378944E12,1.3795488E12,1.3801536E12,1.3807584E12,1.3813632E12,1.381968E12,1.3825728E12,1.3831776E12,1.3837824E12,1.3843872E12,1.384992E12,1.3855968E12,1.3862016E12,1.3868064E12,1.3874112E12,1.388016E12,1.3572576E12,1.3578624E12,1.3584672E12,1.359072E12,1.3596768E12,1.3602816E12,1.3608864E12,1.3614912E12,1.362096E12,1.3627008E12,1.3633056E12,1.3639104E12,1.3645152E12,1.36512E12,1.3657248E12,1.3663296E12,1.3669344E12,1.3675392E12,1.368144E12,1.3687488E12,1.3693536E12,1.3699584E12,1.3705632E12,1.371168E12,1.3717728E12,1.3723776E12,1.3729824E12,1.3735872E12,1.374192E12,1.3747968E12,1.3754016E12,1.3760064E12,1.3766112E12,1.377216E12,1.3778208E12,1.3784256E12,1.3790304E12,1.3796352E12,1.38024E12,1.3808448E12,1.3814496E12,1.3820544E12,1.3826592E12,1.383264E12,1.3838688E12,1.3844736E12,1.3850784E12,1.3856832E12,1.386288E12,1.3868928E12,1.3874976E12,1.3881024E12,1.357344E12,1.3579488E12,1.3585536E12,1.3591584E12,1.3597632E12,1.360368E12,1.3609728E12,1.3615776E12,1.3621824E12,1.3627872E12,1.363392E12,1.3639968E12,1.3646016E12,1.3652064E12,1.3658112E12,1.366416E12,1.3670208E12,1.3676256E12,1.3682304E12,1.3688352E12,1.36944E12,1.3700448E12,1.3706496E12,1.3712544E12,1.3718592E12,1.372464E12,1.3730688E12,1.3736736E12,1.3742784E12,1.3748832E12,1.375488E12,1.3760928E12,1.3766976E12,1.3773024E12,1.3779072E12,1.378512E12,1.3791168E12,1.3797216E12,1.3803264E12,1.3809312E12,1.381536E12,1.3821408E12,1.3827456E12,1.3833504E12,1.3839552E12,1.38456E12,1.3851648E12,1.3857696E12,1.3863744E12,1.3869792E12,1.387584E12,1.3881888E12,1.3574304E12,1.3580352E12,1.35864E12,1.3592448E12,1.3598496E12,1.3604544E12,1.3610592E12,1.361664E12,1.3622688E12,1.3628736E12,1.3634784E12,1.3640832E12,1.364688E12,1.3652928E12,1.3658976E12,1.3665024E12,1.3671072E12,1.367712E12,1.3683168E12,1.3689216E12,1.3695264E12,1.3701312E12,1.370736E12,1.3713408E12,1.3719456E12,1.3725504E12,1.3731552E12,1.37376E12,1.3743648E12,1.3749696E12,1.3755744E12,1.3761792E12,1.376784E12,1.3773888E12,1.3779936E12,1.3785984E12,1.3792032E12,1.379808E12,1.3804128E12,1.3810176E12,1.3816224E12,1.3822272E12,1.382832E12,1.3834368E12,1.3840416E12,1.3846464E12,1.3852512E12,1.385856E12,1.3864608E12,1.3870656E12,1.3876704E12,1.3882752E12],\n",
       "\"resid\":[-41.80769230769238,-46.80769230769238,-62.80769230769238,-51.80769230769238,-42.80769230769238,-45.80769230769238,-26.807692307692378,-13.807692307692378,2.1923076923076223,5.192307692307622,6.192307692307622,3.1923076923076223,-4.807692307692378,6.192307692307622,20.192307692307622,10.192307692307622,8.192307692307622,5.192307692307622,4.192307692307622,8.192307692307622,-46.80769230769238,7.192307692307622,12.192307692307622,15.192307692307622,19.192307692307622,-8.807692307692378,29.192307692307622,24.192307692307622,25.192307692307622,24.192307692307622,25.192307692307622,26.192307692307622,21.192307692307622,7.192307692307622,-45.80769230769238,16.192307692307622,17.192307692307622,18.192307692307622,18.192307692307622,19.192307692307622,12.192307692307622,16.192307692307622,8.192307692307622,3.1923076923076223,8.192307692307622,10.192307692307622,-32.80769230769238,29.192307692307622,-12.807692307692378,-10.807692307692378,10.192307692307622,-6.807692307692378,-109.35849056603854,-52.35849056603854,-57.35849056603854,-61.35849056603854,-61.35849056603854,-55.35849056603854,-58.35849056603854,-8.35849056603854,-13.35849056603854,13.64150943396146,14.64150943396146,15.64150943396146,21.64150943396146,31.64150943396146,23.64150943396146,22.64150943396146,13.64150943396146,8.64150943396146,3.6415094339614598,3.6415094339614598,10.64150943396146,29.64150943396146,8.64150943396146,28.64150943396146,30.64150943396146,41.64150943396146,-6.35849056603854,49.64150943396146,44.64150943396146,45.64150943396146,45.64150943396146,44.64150943396146,43.64150943396146,34.64150943396146,13.64150943396146,4.64150943396146,9.64150943396146,9.64150943396146,8.64150943396146,13.64150943396146,12.64150943396146,11.64150943396146,12.64150943396146,13.64150943396146,15.64150943396146,21.64150943396146,21.64150943396146,37.64150943396146,21.64150943396146,-8.35849056603854,-2.3584905660385402,-190.35849056603854,-175.35849056603854,-19.69230769230876,-60.69230769230876,-61.69230769230876,-65.69230769230876,-62.69230769230876,-61.69230769230876,-44.69230769230876,-13.69230769230876,-17.69230769230876,9.30769230769124,11.30769230769124,7.307692307691241,14.30769230769124,29.30769230769124,26.30769230769124,25.30769230769124,13.30769230769124,1.3076923076912408,2.307692307691241,4.307692307691241,9.30769230769124,11.30769230769124,7.307692307691241,20.30769230769124,22.30769230769124,32.30769230769124,20.30769230769124,41.30769230769124,38.30769230769124,37.30769230769124,38.30769230769124,38.30769230769124,34.30769230769124,27.30769230769124,10.30769230769124,-14.69230769230876,-15.69230769230876,9.30769230769124,13.30769230769124,12.30769230769124,11.30769230769124,11.30769230769124,12.30769230769124,10.30769230769124,10.30769230769124,13.30769230769124,14.30769230769124,51.30769230769124,-4.692307692308759,-8.69230769230876,-6.692307692308759,-243.69230769230876,-51.749999999999886,-33.749999999999886,-38.749999999999886,-40.749999999999886,-37.749999999999886,-33.749999999999886,-9.749999999999886,-4.749999999999886,-1.7499999999998863,14.250000000000114,16.250000000000114,14.250000000000114,16.250000000000114,19.250000000000114,26.250000000000114,26.250000000000114,17.250000000000114,17.250000000000114,15.250000000000114,16.250000000000114,22.250000000000114,23.250000000000114,10.250000000000114,23.250000000000114,29.250000000000114,29.250000000000114,-228.7499999999999,40.250000000000114,37.250000000000114,37.250000000000114,34.250000000000114,35.250000000000114,34.250000000000114,24.250000000000114,13.250000000000114,3.2500000000001137,26.250000000000114,26.250000000000114,30.250000000000114,29.250000000000114,28.250000000000114,29.250000000000114,26.250000000000114,-43.749999999999886,25.250000000000114,22.250000000000114,34.250000000000114,-331.7499999999999,3.2500000000001137,2.2500000000001137,8.250000000000114,-29.749999999999886,-52.46153846153754,-37.46153846153754,-43.46153846153754,-45.46153846153754,-41.46153846153754,-37.46153846153754,-13.461538461537543,-10.461538461537543,-9.461538461537543,11.538461538462457,11.538461538462457,9.538461538462457,6.538461538462457,13.538461538462457,21.538461538462457,20.538461538462457,13.538461538462457,10.538461538462457,10.538461538462457,12.538461538462457,10.538461538462457,18.538461538462457,7.538461538462457,21.538461538462457,25.538461538462457,26.538461538462457,-145.46153846153754,34.53846153846246,31.538461538462457,31.538461538462457,31.538461538462457,31.538461538462457,30.538461538462457,21.538461538462457,-2.4615384615375433,-0.4615384615375433,28.538461538462457,26.538461538462457,28.538461538462457,27.538461538462457,23.538461538462457,25.538461538462457,21.538461538462457,18.538461538462457,18.538461538462457,17.538461538462457,31.538461538462457,-306.46153846153754,2.5384615384624567,2.5384615384624567,12.538461538462457,-4.461538461537543,-24.615384615383505,-54.615384615383505,-70.6153846153835,-64.6153846153835,-62.615384615383505,-60.615384615383505,-6.615384615383505,-1.6153846153835048,20.384615384616495,20.384615384616495,22.384615384616495,22.384615384616495,24.384615384616495,25.384615384616495,25.384615384616495,21.384615384616495,12.384615384616495,0.38461538461649525,-6.615384615383505,4.384615384616495,-16.615384615383505,9.384615384616495,34.384615384616495,56.384615384616495,67.3846153846165,67.3846153846165,60.384615384616495,66.3846153846165,65.3846153846165,66.3846153846165,64.3846153846165,62.384615384616495,35.384615384616495,29.384615384616495,-64.6153846153835,-56.615384615383505,-58.615384615383505,-51.615384615383505,-62.615384615383505,-57.615384615383505,-68.6153846153835,-60.615384615383505,-59.615384615383505,-55.615384615383505,-29.615384615383505,-30.615384615383505,-0.6153846153835048,112.3846153846165,-53.615384615383505,-52.615384615383505,66.3846153846165,69.3846153846165,-59.4807692307694,-63.4807692307694,-105.4807692307694,-68.4807692307694,-77.4807692307694,-62.4807692307694,-43.4807692307694,-11.480769230769397,21.519230769230603,16.519230769230603,15.519230769230603,13.519230769230603,5.519230769230603,19.519230769230603,25.519230769230603,27.519230769230603,21.519230769230603,20.519230769230603,4.519230769230603,19.519230769230603,-162.4807692307694,19.519230769230603,16.519230769230603,26.519230769230603,31.519230769230603,26.519230769230603,42.5192307692306,39.5192307692306,37.5192307692306,38.5192307692306,37.5192307692306,37.5192307692306,22.519230769230603,11.519230769230603,-173.4807692307694,16.519230769230603,8.519230769230603,12.519230769230603,22.519230769230603,25.519230769230603,10.519230769230603,23.519230769230603,18.519230769230603,10.519230769230603,3.519230769230603,4.519230769230603,4.519230769230603,95.5192307692306,-16.480769230769397,-11.480769230769397,3.519230769230603,-3.480769230769397]\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"resid\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":800,\n",
       "\"height\":400\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"format\":\"%Y-%m-%d\",\n",
       "\"datetime\":true\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"geom\":\"hline\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"yintercept\":0,\n",
       "\"size\":3,\n",
       "\"color\":\"yellow\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"gray\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"geom\":\"smooth\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"method\":\"loess\",\n",
       "\"span\":0.3,\n",
       "\"data\":{\n",
       "\"..ymin..\":[-82.3393734860784,-77.29594362824403,-72.19088623160269,-67.02944168558483,-61.82648096118335,-56.603717050569486,-51.38570952667065,-46.19661135892521,-41.05732491647778,-35.98262273932321,-30.969203446402787,-25.950115915886016,-20.74059236035644,-15.598224825872816,-10.585852952127546,-5.916607368911877,-1.7989953759762871,1.6182393601266636,4.272630065663156,6.184258969956259,7.439073365762925,8.172943476391366,8.5171169339532,8.59894777059216,8.549705512344758,8.503592995865652,8.526274148999386,8.641729471386984,8.874260626316783,9.229709159243576,9.72584102843731,10.466163431201442,11.551828563080614,12.997633636175532,14.731250324566826,16.639058838251962,18.61338005504742,20.56936017904386,22.43918745832032,24.156982271900112,25.646063950981123,26.843946465570387,27.707754219535637,28.22552600269486,28.318811926799086,27.89932948827347,26.973900387848648,25.62747485397705,24.01253799796128,22.31463952383789,20.674081296708604,19.148226923066172,17.719447093053645,16.35671459059793,15.054453525300264,13.825465790141227,12.696358348860938,11.713600105206144,10.931628190965494,10.389572687493441,10.07368844037209,9.887209358878955,9.690806650169618,9.366506458873026,8.822248205201696,7.983617395359461,6.831977445163811,5.453255818780208,3.756028785993138,2.01899298505605,0.3227836924600833,-1.357935199193082,-3.0417045795548665,-4.740203274282895,-6.461715630336155,-8.212285025838373,-9.991490729768088,-11.794676363779573,-13.616895308779565,-15.4565247627507],\n",
       "\"..ymax..\":[-62.58472123760468,-57.91465198427428,-53.180433628839296,-48.38715608059492,-43.54952883461337,-38.68909153010026,-33.830217563094905,-28.996859887740722,-24.209705936317587,-19.483297238757935,-14.814084112601272,-10.134848562852339,-5.260536021656871,-0.4484304677472126,4.238959221403828,8.58885728790927,12.393136806430032,15.503461320841128,17.857799330583426,19.476697461729103,20.446597350034764,20.903894006027926,20.98039036501888,20.80402580761323,20.506684110838805,20.22320931052047,20.019930571714198,19.92151366289119,19.952960319566614,20.120820416701413,20.443568585818305,21.025411776087232,21.968182496511858,23.287327264600695,24.91112373782717,26.72650214644282,28.626264970232096,30.52595990969029,32.35808629391152,34.05697682078168,35.54605849986269,36.76284530116159,37.66435395018207,38.23841091787954,38.40625523498994,38.07920290153381,37.263594016273814,36.043828787408295,34.57178634284707,33.03236708121888,31.56519255416644,30.226926616316003,28.99923128455785,27.850371013312746,26.774069839955228,25.782444388635273,24.901436385882008,24.176873536271824,23.662578720602053,23.397096671765283,23.366126932144937,23.472378623799223,23.57602861088408,23.558638641279344,23.327712862022842,22.808429568890837,21.981771803289412,20.93331215747978,19.571296139026817,18.174112318857567,16.822109193025355,15.489683780967116,14.158046891629624,12.815288689292846,11.452909890133082,10.064667100731604,8.65079487522182,7.215776238983815,5.764396335190194,4.298127485723011],\n",
       "\"event_date\":[1.3569984E12,1.3573964962025317E12,1.3577945924050632E12,1.358192688607595E12,1.3585907848101265E12,1.3589888810126582E12,1.35938697721519E12,1.3597850734177214E12,1.3601831696202532E12,1.360581265822785E12,1.3609793620253164E12,1.3613774582278481E12,1.3617755544303796E12,1.3621736506329114E12,1.362571746835443E12,1.3629698430379746E12,1.3633679392405063E12,1.363766035443038E12,1.3641641316455696E12,1.3645622278481013E12,1.3649603240506328E12,1.3653584202531646E12,1.3657565164556963E12,1.3661546126582278E12,1.3665527088607595E12,1.3669508050632913E12,1.3673489012658228E12,1.3677469974683545E12,1.368145093670886E12,1.3685431898734177E12,1.3689412860759495E12,1.369339382278481E12,1.3697374784810127E12,1.3701355746835442E12,1.370533670886076E12,1.3709317670886077E12,1.3713298632911392E12,1.371727959493671E12,1.3721260556962026E12,1.3725241518987341E12,1.3729222481012659E12,1.3733203443037974E12,1.373718440506329E12,1.3741165367088608E12,1.3745146329113923E12,1.374912729113924E12,1.3753108253164558E12,1.3757089215189873E12,1.376107017721519E12,1.3765051139240505E12,1.3769032101265823E12,1.377301306329114E12,1.3776994025316455E12,1.3780974987341772E12,1.378495594936709E12,1.3788936911392405E12,1.3792917873417722E12,1.3796898835443037E12,1.3800879797468354E12,1.3804860759493672E12,1.3808841721518987E12,1.3812822683544304E12,1.381680364556962E12,1.3820784607594937E12,1.3824765569620254E12,1.382874653164557E12,1.3832727493670886E12,1.3836708455696204E12,1.3840689417721519E12,1.3844670379746836E12,1.384865134177215E12,1.3852632303797468E12,1.3856613265822786E12,1.38605942278481E12,1.3864575189873418E12,1.3868556151898735E12,1.387253711392405E12,1.3876518075949368E12,1.3880499037974683E12,1.388448E12],\n",
       "\"resid\":[-72.46204736184154,-67.60529780625916,-62.68565993022099,-57.708298883089874,-52.68800489789836,-47.64640429033487,-42.60796354488278,-37.59673562333297,-32.633515426397686,-27.732959989040573,-22.89164377950203,-18.04248223936918,-13.000564191006657,-8.023327646810014,-3.173446865361859,1.3361249594986966,5.297070715226873,8.560850340483896,11.06521469812329,12.830478215842682,13.942835357898845,14.538418741209645,14.74875364948604,14.701486789102695,14.528194811591781,14.363401153193061,14.273102360356791,14.281621567139087,14.413610472941699,14.675264787972495,15.084704807127807,15.745787603644336,16.760005529796235,18.142480450388113,19.821187031197,21.68278049234739,23.619822512639757,25.547660044367074,27.39863687611592,29.106979546340895,30.596061225421906,31.803395883365987,32.68605408485885,33.2319684602872,33.362533580894514,32.98926619490364,32.11874720206123,30.83565182069267,29.292162170404175,27.673503302528385,26.119636925437522,24.687576769691088,23.359339188805748,22.10354280195534,20.914261682627746,19.80395508938825,18.798897367371474,17.945236820738984,17.297103455783773,16.893334679629362,16.719907686258512,16.67979399133909,16.63341763052685,16.462572550076185,16.07498053361227,15.396023482125148,14.406874624226612,13.193283988129993,11.663662462509977,10.096552651956808,8.57244644274272,7.065874290887018,5.558171156037379,4.037542707504975,2.495597129898464,0.926191037446615,-0.6703479272731351,-2.2894500623978784,-3.9262494867946858,-5.579198638513844]\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"qLxVdM\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e1800d580>"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily3, aes(x='event_date', y='resid')) \\\n",
    "+ geom_hline(yintercept=0, size=3, color='yellow') \\\n",
    "+ geom_line(color='gray') \\\n",
    "+ geom_smooth(method='loess', span=0.3) \\\n",
    "+ scale_x_datetime(format='%Y-%m-%d') \\\n",
    "+ ggsize(800, 400) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "上图可以看出，1月和12月残差较低, 即实际航班量较低，而夏季(5月到9月)残差较高，即航班量较高。\n",
    "因为只有1年的数据，所以还不能很好的定量分析，但是可以定性解释。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 分箱"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**周六季节性特征：** "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"F9A4wN\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"event_date\":[1.357344E12,1.3579488E12,1.3585536E12,1.3591584E12,1.3597632E12,1.360368E12,1.3609728E12,1.3615776E12,1.3621824E12,1.3627872E12,1.363392E12,1.3639968E12,1.3646016E12,1.3652064E12,1.3658112E12,1.366416E12,1.3670208E12,1.3676256E12,1.3682304E12,1.3688352E12,1.36944E12,1.3700448E12,1.3706496E12,1.3712544E12,1.3718592E12,1.372464E12,1.3730688E12,1.3736736E12,1.3742784E12,1.3748832E12,1.375488E12,1.3760928E12,1.3766976E12,1.3773024E12,1.3779072E12,1.378512E12,1.3791168E12,1.3797216E12,1.3803264E12,1.3809312E12,1.381536E12,1.3821408E12,1.3827456E12,1.3833504E12,1.3839552E12,1.38456E12,1.3851648E12,1.3857696E12,1.3863744E12,1.3869792E12,1.387584E12,1.3881888E12],\n",
       "\"y\":[720.0,690.0,674.0,680.0,682.0,684.0,738.0,743.0,765.0,765.0,767.0,767.0,769.0,770.0,770.0,766.0,757.0,745.0,738.0,749.0,728.0,754.0,779.0,801.0,812.0,812.0,805.0,811.0,810.0,811.0,809.0,807.0,780.0,774.0,680.0,688.0,686.0,693.0,682.0,687.0,676.0,684.0,685.0,689.0,715.0,714.0,744.0,857.0,691.0,692.0,811.0,814.0]\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":800,\n",
       "\"height\":400\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"format\":\"%Y-%m-%d\",\n",
       "\"datetime\":true\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"geom\":\"point\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"#FF00FF\",\n",
       "\"size\":2,\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"#4169E1\",\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"F9A4wN\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e17f43580>"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily2.query(\"weekday == '周六'\"), aes(x='event_date', y='y')) \\\n",
    "+ geom_point(color='#FF00FF', size=2) \\\n",
    "+ geom_line(color='#4169E1') \\\n",
    "+ scale_x_datetime(format='%Y-%m-%d') \\\n",
    "+ ggsize(800, 400) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "从上图可以看出，夏季周六的航班量相比全年较高，这是因为人们并不介意周六去旅行， 这是旅行增加的，而不是商务性质的出行。夏季长假从6月初开始，8月末结束。 这与机场所在州的学校暑假放假时间非常符合（2013年是6月26到9月9日）。  \n",
    "从图中还能看出，春节的航班量比秋季更多，有假说认为是秋季有大型节日，感恩节和圣诞节。  \n",
    "下面通过分箱把学校暑假切出来，再进行可视化。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x</th>\n",
       "      <th>event_date</th>\n",
       "      <th>y</th>\n",
       "      <th>weekday</th>\n",
       "      <th>term</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-07</td>\n",
       "      <td>933</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-14</td>\n",
       "      <td>928</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-21</td>\n",
       "      <td>912</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-28</td>\n",
       "      <td>923</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-02-04</td>\n",
       "      <td>932</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   x event_date    y weekday    term\n",
       "0  0 2013-01-07  933      周一  spring\n",
       "1  0 2013-01-14  928      周一  spring\n",
       "2  0 2013-01-21  912      周一  spring\n",
       "3  0 2013-01-28  923      周一  spring\n",
       "4  0 2013-02-04  932      周一  spring"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_daily4 = df_daily2.copy()\n",
    "df_daily4['term'] = pd.cut(df_daily4['event_date'], \n",
    "                           bins=[pd.Timestamp(x) for x in ['2013-01-01', '2013-06-05', '2013-08-25', '2014-01-01']], \n",
    "                           labels=['spring', 'summer', 'fall'])\n",
    "df_daily4.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"5ANsjT\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"event_date\":[1.357344E12,1.3579488E12,1.3585536E12,1.3591584E12,1.3597632E12,1.360368E12,1.3609728E12,1.3615776E12,1.3621824E12,1.3627872E12,1.363392E12,1.3639968E12,1.3646016E12,1.3652064E12,1.3658112E12,1.366416E12,1.3670208E12,1.3676256E12,1.3682304E12,1.3688352E12,1.36944E12,1.3700448E12,1.3706496E12,1.3712544E12,1.3718592E12,1.372464E12,1.3730688E12,1.3736736E12,1.3742784E12,1.3748832E12,1.375488E12,1.3760928E12,1.3766976E12,1.3773024E12,1.3779072E12,1.378512E12,1.3791168E12,1.3797216E12,1.3803264E12,1.3809312E12,1.381536E12,1.3821408E12,1.3827456E12,1.3833504E12,1.3839552E12,1.38456E12,1.3851648E12,1.3857696E12,1.3863744E12,1.3869792E12,1.387584E12,1.3881888E12],\n",
       "\"y\":[720.0,690.0,674.0,680.0,682.0,684.0,738.0,743.0,765.0,765.0,767.0,767.0,769.0,770.0,770.0,766.0,757.0,745.0,738.0,749.0,728.0,754.0,779.0,801.0,812.0,812.0,805.0,811.0,810.0,811.0,809.0,807.0,780.0,774.0,680.0,688.0,686.0,693.0,682.0,687.0,676.0,684.0,685.0,689.0,715.0,714.0,744.0,857.0,691.0,692.0,811.0,814.0],\n",
       "\"term\":[\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\"]\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"y\",\n",
       "\"group\":\"term\",\n",
       "\"color\":\"term\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":800,\n",
       "\"height\":400\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"color\",\n",
       "\"palette\":\"Set2\",\n",
       "\"scale_mapper_kind\":\"color_brewer\"\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"format\":\"%Y-%m\",\n",
       "\"datetime\":true\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"geom\":\"point\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"size\":2,\n",
       "\"alpha\":0.8,\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"size\":1,\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"5ANsjT\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e180426d0>"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily4.query(\"weekday == '周六'\"), aes(x='event_date', y='y', group='term', color='term')) \\\n",
    "+ geom_point(size=2, alpha=0.8) \\\n",
    "+ geom_line(size=1) \\\n",
    "+ scale_color_brewer(palette='Set2') \\\n",
    "+ scale_x_datetime(format='%Y-%m') \\\n",
    "+ ggsize(800, 400)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"hRuBpe\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"weekday\",\n",
       "\"y\":\"y\",\n",
       "\"color\":\"term\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":800,\n",
       "\"height\":400\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"color\",\n",
       "\"palette\":\"Set2\",\n",
       "\"scale_mapper_kind\":\"color_brewer\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"geom\":\"boxplot\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"size\":1,\n",
       "\"data\":{\n",
       "\"..middle..\":[977.5,960.0,967.0,980.5,977.5,747.0,901.0,NaN,999.0,NaN,995.0,997.0,NaN,997.5,NaN,996.0,808.0,926.0,NaN,NaN,985.0,NaN,NaN,NaN,NaN,964.0,NaN,NaN,973.0,NaN,NaN,989.5,NaN,986.0,NaN,NaN,NaN,690.0,NaN,NaN,901.0,842.0],\n",
       "\"..lower..\":[932.5,918.5,930.5,944.0,942.0,724.0,830.5,NaN,992.0,NaN,984.0,987.5,NaN,989.5,NaN,989.0,790.5,916.0,NaN,NaN,973.0,NaN,NaN,NaN,NaN,958.0,NaN,NaN,957.0,NaN,NaN,969.0,NaN,970.0,NaN,NaN,NaN,685.5,NaN,NaN,895.0,842.0],\n",
       "\"..upper..\":[981.0,966.5,974.0,983.0,979.5,765.5,911.0,NaN,1000.0,NaN,996.5,1001.0,NaN,1002.0,NaN,999.0,811.0,929.5,NaN,NaN,991.5,NaN,NaN,NaN,NaN,966.0,NaN,NaN,975.0,NaN,NaN,993.0,NaN,993.5,NaN,NaN,NaN,714.5,NaN,NaN,909.0,842.0],\n",
       "\"..ymin..\":[912.0,890.0,897.0,914.0,915.0,674.0,729.0,NaN,987.0,NaN,980.0,983.0,NaN,976.0,NaN,975.0,774.0,903.0,NaN,NaN,962.0,NaN,NaN,NaN,NaN,949.0,NaN,NaN,947.0,NaN,NaN,936.0,NaN,963.0,NaN,NaN,NaN,676.0,NaN,NaN,875.0,842.0],\n",
       "\"..ymax..\":[995.0,983.0,992.0,992.0,989.0,770.0,919.0,NaN,1004.0,NaN,1001.0,1004.0,NaN,1006.0,NaN,1002.0,812.0,934.0,NaN,NaN,1004.0,NaN,NaN,NaN,NaN,973.0,NaN,NaN,977.0,NaN,NaN,1000.0,NaN,999.0,NaN,NaN,NaN,744.0,NaN,NaN,917.0,842.0],\n",
       "\"weekday\":[\"周一\",\"周二\",\"周三\",\"周四\",\"周五\",\"周六\",\"周日\",\"周一\",\"周一\",\"周二\",\"周二\",\"周三\",\"周四\",\"周四\",\"周五\",\"周五\",\"周六\",\"周日\",\"周一\",\"周一\",\"周一\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周三\",\"周三\",\"周三\",\"周四\",\"周四\",\"周四\",\"周五\",\"周五\",\"周六\",\"周六\",\"周六\",\"周六\",\"周日\",\"周日\",\"周日\",\"周二\"],\n",
       "\"y\":[NaN,NaN,NaN,NaN,NaN,NaN,NaN,966.0,NaN,945.0,NaN,NaN,737.0,NaN,822.0,NaN,NaN,NaN,929.0,942.0,NaN,989.0,943.0,761.0,776.0,NaN,1014.0,719.0,NaN,922.0,634.0,NaN,661.0,NaN,857.0,811.0,814.0,NaN,718.0,987.0,NaN,NaN],\n",
       "\"term\":[\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",null]\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"hRuBpe\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e1728e520>"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily4, aes(x='weekday', y='y', color='term')) \\\n",
    "+ geom_boxplot(size=1) \\\n",
    "+ scale_color_brewer(palette='Set2') \\\n",
    "+ ggsize(800, 400)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "从上图来看，假期效应是相当明显的，因此有必要分段进行建模拟合。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 分段回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                 Generalized Linear Model Regression Results                  \n",
      "==============================================================================\n",
      "Dep. Variable:                      y   No. Observations:                  364\n",
      "Model:                            GLM   Df Residuals:                      343\n",
      "Model Family:                Gaussian   Df Model:                           20\n",
      "Link Function:               identity   Scale:                          2108.4\n",
      "Method:                          IRLS   Log-Likelihood:                -1898.6\n",
      "Date:                Tue, 09 Nov 2021   Deviance:                   7.2317e+05\n",
      "Time:                        15:38:49   Pearson chi2:                 7.23e+05\n",
      "No. Iterations:                     3   Pseudo R-squ. (CS):             0.9496\n",
      "Covariance Type:            nonrobust                                         \n",
      "================================================================================================\n",
      "                                   coef    std err          z      P>|z|      [0.025      0.975]\n",
      "------------------------------------------------------------------------------------------------\n",
      "Intercept                      961.2727      9.790     98.194      0.000     942.086     980.460\n",
      "weekday[T.周二]                  -16.5455     13.844     -1.195      0.232     -43.680      10.589\n",
      "weekday[T.周三]                   -8.8379     13.693     -0.645      0.519     -35.676      18.000\n",
      "weekday[T.周四]                    4.0909     13.844      0.295      0.768     -23.044      31.226\n",
      "weekday[T.周五]                    0.7273     13.844      0.053      0.958     -26.407      27.862\n",
      "weekday[T.周六]                 -223.9545     13.844    -16.176      0.000    -251.089    -196.820\n",
      "weekday[T.周日]                  -89.0455     13.844     -6.432      0.000    -116.180     -61.911\n",
      "term[T.summer]                  32.9091     16.956      1.941      0.052      -0.324      66.142\n",
      "term[T.fall]                    17.9904     14.381      1.251      0.211     -10.195      46.176\n",
      "weekday[T.周二]:term[T.summer]    10.3636     23.979      0.432      0.666     -36.635      57.362\n",
      "weekday[T.周三]:term[T.summer]     9.2016     23.892      0.385      0.700     -37.626      56.030\n",
      "weekday[T.周四]:term[T.summer]   -23.6894     23.644     -1.002      0.316     -70.031      22.652\n",
      "weekday[T.周五]:term[T.summer]   -15.0758     23.644     -0.638      0.524     -61.417      31.265\n",
      "weekday[T.周六]:term[T.summer]    30.6894     23.644      1.298      0.194     -15.652      77.031\n",
      "weekday[T.周日]:term[T.summer]    17.0303     23.644      0.720      0.471     -29.311      63.371\n",
      "weekday[T.周二]:term[T.fall]     -19.1388     20.337     -0.941      0.347     -58.999      20.721\n",
      "weekday[T.周三]:term[T.fall]     -14.0919     20.386     -0.691      0.489     -54.048      25.864\n",
      "weekday[T.周四]:term[T.fall]     -23.0207     20.488     -1.124      0.261     -63.177      17.135\n",
      "weekday[T.周五]:term[T.fall]     -14.1015     20.488     -0.688      0.491     -54.258      26.055\n",
      "weekday[T.周六]:term[T.fall]     -39.3086     20.488     -1.919      0.055     -79.465       0.847\n",
      "weekday[T.周日]:term[T.fall]       4.3379     20.488      0.212      0.832     -35.818      44.494\n",
      "================================================================================================\n"
     ]
    }
   ],
   "source": [
    "mod2 = smf.glm('y ~ weekday * term', data=df_daily4).fit()\n",
    "print(mod2.summary())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x</th>\n",
       "      <th>event_date</th>\n",
       "      <th>y</th>\n",
       "      <th>weekday</th>\n",
       "      <th>term</th>\n",
       "      <th>pred</th>\n",
       "      <th>resid</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-07</td>\n",
       "      <td>933</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>961.272727</td>\n",
       "      <td>-28.272727</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-14</td>\n",
       "      <td>928</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>961.272727</td>\n",
       "      <td>-33.272727</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-21</td>\n",
       "      <td>912</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>961.272727</td>\n",
       "      <td>-49.272727</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-28</td>\n",
       "      <td>923</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>961.272727</td>\n",
       "      <td>-38.272727</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-02-04</td>\n",
       "      <td>932</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>961.272727</td>\n",
       "      <td>-29.272727</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   x event_date    y weekday    term        pred      resid\n",
       "0  0 2013-01-07  933      周一  spring  961.272727 -28.272727\n",
       "1  0 2013-01-14  928      周一  spring  961.272727 -33.272727\n",
       "2  0 2013-01-21  912      周一  spring  961.272727 -49.272727\n",
       "3  0 2013-01-28  923      周一  spring  961.272727 -38.272727\n",
       "4  0 2013-02-04  932      周一  spring  961.272727 -29.272727"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_daily5 = df_daily4.copy()\n",
    "df_daily5['pred'] = mod2.fittedvalues # 预测值\n",
    "df_daily5['resid'] = mod2.resid_deviance # 残差\n",
    "df_daily5.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'chalk':'https://assets.pyecharts.org/assets/themes/chalk'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"dd14fea813ef4112b3c45e6d53daf48c\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'chalk'], function(echarts) {\n",
       "                var chart_dd14fea813ef4112b3c45e6d53daf48c = echarts.init(\n",
       "                    document.getElementById('dd14fea813ef4112b3c45e6d53daf48c'), 'chalk', {renderer: 'canvas'});\n",
       "                var option_dd14fea813ef4112b3c45e6d53daf48c = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"without_term\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"2013-01-07\",\n",
       "                    -41.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-14\",\n",
       "                    -46.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-21\",\n",
       "                    -62.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-28\",\n",
       "                    -51.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-04\",\n",
       "                    -42.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-11\",\n",
       "                    -45.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-18\",\n",
       "                    -26.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-25\",\n",
       "                    -13.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-04\",\n",
       "                    2.1923076923076223\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-11\",\n",
       "                    5.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-18\",\n",
       "                    6.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-25\",\n",
       "                    3.1923076923076223\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-01\",\n",
       "                    -4.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-08\",\n",
       "                    6.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-15\",\n",
       "                    20.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-22\",\n",
       "                    10.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-29\",\n",
       "                    8.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-06\",\n",
       "                    5.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-13\",\n",
       "                    4.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-20\",\n",
       "                    8.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-27\",\n",
       "                    -46.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-03\",\n",
       "                    7.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-10\",\n",
       "                    12.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-17\",\n",
       "                    15.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-24\",\n",
       "                    19.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-01\",\n",
       "                    -8.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-08\",\n",
       "                    29.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-15\",\n",
       "                    24.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-22\",\n",
       "                    25.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-29\",\n",
       "                    24.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-05\",\n",
       "                    25.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-12\",\n",
       "                    26.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-19\",\n",
       "                    21.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-26\",\n",
       "                    7.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-02\",\n",
       "                    -45.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-09\",\n",
       "                    16.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-16\",\n",
       "                    17.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-23\",\n",
       "                    18.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-30\",\n",
       "                    18.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-07\",\n",
       "                    19.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-14\",\n",
       "                    12.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-21\",\n",
       "                    16.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-28\",\n",
       "                    8.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-04\",\n",
       "                    3.1923076923076223\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-11\",\n",
       "                    8.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-18\",\n",
       "                    10.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-25\",\n",
       "                    -32.80769230769238\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-02\",\n",
       "                    29.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-09\",\n",
       "                    -12.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-16\",\n",
       "                    -10.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-23\",\n",
       "                    10.192307692307622\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-30\",\n",
       "                    -6.807692307692378\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-01\",\n",
       "                    -109.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-08\",\n",
       "                    -52.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-15\",\n",
       "                    -57.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-22\",\n",
       "                    -61.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-29\",\n",
       "                    -61.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-05\",\n",
       "                    -55.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-12\",\n",
       "                    -58.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-19\",\n",
       "                    -8.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-26\",\n",
       "                    -13.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-05\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-12\",\n",
       "                    14.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-19\",\n",
       "                    15.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-26\",\n",
       "                    21.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-02\",\n",
       "                    31.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-09\",\n",
       "                    23.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-16\",\n",
       "                    22.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-23\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-30\",\n",
       "                    8.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-07\",\n",
       "                    3.6415094339614598\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-14\",\n",
       "                    3.6415094339614598\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-21\",\n",
       "                    10.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-28\",\n",
       "                    29.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-04\",\n",
       "                    8.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-11\",\n",
       "                    28.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-18\",\n",
       "                    30.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-25\",\n",
       "                    41.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-02\",\n",
       "                    -6.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-09\",\n",
       "                    49.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-16\",\n",
       "                    44.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-23\",\n",
       "                    45.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-30\",\n",
       "                    45.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-06\",\n",
       "                    44.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-13\",\n",
       "                    43.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-20\",\n",
       "                    34.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-27\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-03\",\n",
       "                    4.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-10\",\n",
       "                    9.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-17\",\n",
       "                    9.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-24\",\n",
       "                    8.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-01\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-08\",\n",
       "                    12.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-15\",\n",
       "                    11.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-22\",\n",
       "                    12.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-29\",\n",
       "                    13.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-05\",\n",
       "                    15.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-12\",\n",
       "                    21.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-19\",\n",
       "                    21.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-26\",\n",
       "                    37.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-03\",\n",
       "                    21.64150943396146\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-10\",\n",
       "                    -8.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-17\",\n",
       "                    -2.3584905660385402\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-24\",\n",
       "                    -190.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-31\",\n",
       "                    -175.35849056603854\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-02\",\n",
       "                    -19.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-09\",\n",
       "                    -60.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-16\",\n",
       "                    -61.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-23\",\n",
       "                    -65.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-30\",\n",
       "                    -62.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-06\",\n",
       "                    -61.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-13\",\n",
       "                    -44.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-20\",\n",
       "                    -13.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-27\",\n",
       "                    -17.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-06\",\n",
       "                    9.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-13\",\n",
       "                    11.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-20\",\n",
       "                    7.307692307691241\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-27\",\n",
       "                    14.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-03\",\n",
       "                    29.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-10\",\n",
       "                    26.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-17\",\n",
       "                    25.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-24\",\n",
       "                    13.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-01\",\n",
       "                    1.3076923076912408\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-08\",\n",
       "                    2.307692307691241\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-15\",\n",
       "                    4.307692307691241\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-22\",\n",
       "                    9.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-29\",\n",
       "                    11.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-05\",\n",
       "                    7.307692307691241\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-12\",\n",
       "                    20.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-19\",\n",
       "                    22.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-26\",\n",
       "                    32.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-03\",\n",
       "                    20.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-10\",\n",
       "                    41.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-17\",\n",
       "                    38.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-24\",\n",
       "                    37.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-31\",\n",
       "                    38.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-07\",\n",
       "                    38.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-14\",\n",
       "                    34.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-21\",\n",
       "                    27.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-28\",\n",
       "                    10.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-04\",\n",
       "                    -14.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-11\",\n",
       "                    -15.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-18\",\n",
       "                    9.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-25\",\n",
       "                    13.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-02\",\n",
       "                    12.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-09\",\n",
       "                    11.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-16\",\n",
       "                    11.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-23\",\n",
       "                    12.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-30\",\n",
       "                    10.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-06\",\n",
       "                    10.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-13\",\n",
       "                    13.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-20\",\n",
       "                    14.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-27\",\n",
       "                    51.30769230769124\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-04\",\n",
       "                    -4.692307692308759\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-11\",\n",
       "                    -8.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-18\",\n",
       "                    -6.692307692308759\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-25\",\n",
       "                    -243.69230769230876\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-03\",\n",
       "                    -51.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-10\",\n",
       "                    -33.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-17\",\n",
       "                    -38.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-24\",\n",
       "                    -40.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-31\",\n",
       "                    -37.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-07\",\n",
       "                    -33.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-14\",\n",
       "                    -9.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-21\",\n",
       "                    -4.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-28\",\n",
       "                    -1.7499999999998863\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-07\",\n",
       "                    14.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-14\",\n",
       "                    16.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-21\",\n",
       "                    14.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-28\",\n",
       "                    16.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-04\",\n",
       "                    19.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-11\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-18\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-25\",\n",
       "                    17.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-02\",\n",
       "                    17.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-09\",\n",
       "                    15.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-16\",\n",
       "                    16.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-23\",\n",
       "                    22.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-30\",\n",
       "                    23.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-06\",\n",
       "                    10.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-13\",\n",
       "                    23.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-20\",\n",
       "                    29.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-27\",\n",
       "                    29.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-04\",\n",
       "                    -228.7499999999999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-11\",\n",
       "                    40.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-18\",\n",
       "                    37.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-25\",\n",
       "                    37.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-01\",\n",
       "                    34.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-08\",\n",
       "                    35.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-15\",\n",
       "                    34.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-22\",\n",
       "                    24.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-29\",\n",
       "                    13.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-05\",\n",
       "                    3.2500000000001137\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-12\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-19\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-26\",\n",
       "                    30.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-03\",\n",
       "                    29.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-10\",\n",
       "                    28.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-17\",\n",
       "                    29.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-24\",\n",
       "                    26.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-31\",\n",
       "                    -43.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-07\",\n",
       "                    25.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-14\",\n",
       "                    22.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-21\",\n",
       "                    34.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-28\",\n",
       "                    -331.7499999999999\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-05\",\n",
       "                    3.2500000000001137\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-12\",\n",
       "                    2.2500000000001137\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-19\",\n",
       "                    8.250000000000114\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-26\",\n",
       "                    -29.749999999999886\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-04\",\n",
       "                    -52.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-11\",\n",
       "                    -37.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-18\",\n",
       "                    -43.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-25\",\n",
       "                    -45.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-01\",\n",
       "                    -41.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-08\",\n",
       "                    -37.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-15\",\n",
       "                    -13.461538461537543\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-22\",\n",
       "                    -10.461538461537543\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-01\",\n",
       "                    -9.461538461537543\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-08\",\n",
       "                    11.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-15\",\n",
       "                    11.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-22\",\n",
       "                    9.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-29\",\n",
       "                    6.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-05\",\n",
       "                    13.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-12\",\n",
       "                    21.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-19\",\n",
       "                    20.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-26\",\n",
       "                    13.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-03\",\n",
       "                    10.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-10\",\n",
       "                    10.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-17\",\n",
       "                    12.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-24\",\n",
       "                    10.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-31\",\n",
       "                    18.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-07\",\n",
       "                    7.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-14\",\n",
       "                    21.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-21\",\n",
       "                    25.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-28\",\n",
       "                    26.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-05\",\n",
       "                    -145.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-12\",\n",
       "                    34.53846153846246\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-19\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-26\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-02\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-09\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-16\",\n",
       "                    30.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-23\",\n",
       "                    21.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-30\",\n",
       "                    -2.4615384615375433\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-06\",\n",
       "                    -0.4615384615375433\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-13\",\n",
       "                    28.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-20\",\n",
       "                    26.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-27\",\n",
       "                    28.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-04\",\n",
       "                    27.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-11\",\n",
       "                    23.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-18\",\n",
       "                    25.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-25\",\n",
       "                    21.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-01\",\n",
       "                    18.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-08\",\n",
       "                    18.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-15\",\n",
       "                    17.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-22\",\n",
       "                    31.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-29\",\n",
       "                    -306.46153846153754\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-06\",\n",
       "                    2.5384615384624567\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-13\",\n",
       "                    2.5384615384624567\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-20\",\n",
       "                    12.538461538462457\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-27\",\n",
       "                    -4.461538461537543\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-05\",\n",
       "                    -24.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-12\",\n",
       "                    -54.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-19\",\n",
       "                    -70.6153846153835\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-26\",\n",
       "                    -64.6153846153835\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-02\",\n",
       "                    -62.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-09\",\n",
       "                    -60.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-16\",\n",
       "                    -6.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-23\",\n",
       "                    -1.6153846153835048\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-02\",\n",
       "                    20.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-09\",\n",
       "                    20.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-16\",\n",
       "                    22.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-23\",\n",
       "                    22.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-30\",\n",
       "                    24.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-06\",\n",
       "                    25.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-13\",\n",
       "                    25.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-20\",\n",
       "                    21.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-27\",\n",
       "                    12.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-04\",\n",
       "                    0.38461538461649525\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-11\",\n",
       "                    -6.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-18\",\n",
       "                    4.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-25\",\n",
       "                    -16.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-01\",\n",
       "                    9.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-08\",\n",
       "                    34.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-15\",\n",
       "                    56.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-22\",\n",
       "                    67.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-29\",\n",
       "                    67.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-06\",\n",
       "                    60.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-13\",\n",
       "                    66.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-20\",\n",
       "                    65.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-27\",\n",
       "                    66.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-03\",\n",
       "                    64.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-10\",\n",
       "                    62.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-17\",\n",
       "                    35.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-24\",\n",
       "                    29.384615384616495\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-31\",\n",
       "                    -64.6153846153835\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-07\",\n",
       "                    -56.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-14\",\n",
       "                    -58.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-21\",\n",
       "                    -51.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-28\",\n",
       "                    -62.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-05\",\n",
       "                    -57.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-12\",\n",
       "                    -68.6153846153835\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-19\",\n",
       "                    -60.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-26\",\n",
       "                    -59.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-02\",\n",
       "                    -55.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-09\",\n",
       "                    -29.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-16\",\n",
       "                    -30.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-23\",\n",
       "                    -0.6153846153835048\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-30\",\n",
       "                    112.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-07\",\n",
       "                    -53.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-14\",\n",
       "                    -52.615384615383505\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-21\",\n",
       "                    66.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-28\",\n",
       "                    69.3846153846165\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-06\",\n",
       "                    -59.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-13\",\n",
       "                    -63.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-20\",\n",
       "                    -105.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-27\",\n",
       "                    -68.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-03\",\n",
       "                    -77.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-10\",\n",
       "                    -62.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-17\",\n",
       "                    -43.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-24\",\n",
       "                    -11.480769230769397\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-03\",\n",
       "                    21.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-10\",\n",
       "                    16.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-17\",\n",
       "                    15.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-24\",\n",
       "                    13.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-31\",\n",
       "                    5.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-07\",\n",
       "                    19.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-14\",\n",
       "                    25.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-21\",\n",
       "                    27.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-28\",\n",
       "                    21.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-05\",\n",
       "                    20.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-12\",\n",
       "                    4.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-19\",\n",
       "                    19.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-26\",\n",
       "                    -162.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-02\",\n",
       "                    19.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-09\",\n",
       "                    16.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-16\",\n",
       "                    26.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-23\",\n",
       "                    31.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-30\",\n",
       "                    26.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-07\",\n",
       "                    42.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-14\",\n",
       "                    39.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-21\",\n",
       "                    37.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-28\",\n",
       "                    38.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-04\",\n",
       "                    37.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-11\",\n",
       "                    37.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-18\",\n",
       "                    22.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-25\",\n",
       "                    11.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-01\",\n",
       "                    -173.4807692307694\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-08\",\n",
       "                    16.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-15\",\n",
       "                    8.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-22\",\n",
       "                    12.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-29\",\n",
       "                    22.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-06\",\n",
       "                    25.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-13\",\n",
       "                    10.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-20\",\n",
       "                    23.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-27\",\n",
       "                    18.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-03\",\n",
       "                    10.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-10\",\n",
       "                    3.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-17\",\n",
       "                    4.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-24\",\n",
       "                    4.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-01\",\n",
       "                    95.5192307692306\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-08\",\n",
       "                    -16.480769230769397\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-15\",\n",
       "                    -11.480769230769397\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-22\",\n",
       "                    3.519230769230603\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-29\",\n",
       "                    -3.480769230769397\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"with_term\",\n",
       "            \"connectNulls\": false,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"2013-01-07\",\n",
       "                    -28.27272727272691\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-14\",\n",
       "                    -33.27272727272691\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-21\",\n",
       "                    -49.27272727272691\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-28\",\n",
       "                    -38.27272727272691\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-04\",\n",
       "                    -29.27272727272691\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-11\",\n",
       "                    -32.27272727272691\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-18\",\n",
       "                    -13.272727272726911\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-25\",\n",
       "                    -0.272727272726911\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-04\",\n",
       "                    15.727272727273089\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-11\",\n",
       "                    18.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-18\",\n",
       "                    19.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-25\",\n",
       "                    16.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-01\",\n",
       "                    8.727272727273089\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-08\",\n",
       "                    19.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-15\",\n",
       "                    33.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-22\",\n",
       "                    23.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-29\",\n",
       "                    21.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-06\",\n",
       "                    18.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-13\",\n",
       "                    17.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-20\",\n",
       "                    21.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-27\",\n",
       "                    -33.27272727272691\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-03\",\n",
       "                    20.72727272727309\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-10\",\n",
       "                    -7.181818181817789\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-17\",\n",
       "                    -4.181818181817789\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-24\",\n",
       "                    -0.18181818181778908\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-01\",\n",
       "                    -28.18181818181779\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-08\",\n",
       "                    9.818181818182211\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-15\",\n",
       "                    4.818181818182211\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-22\",\n",
       "                    5.818181818182211\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-29\",\n",
       "                    4.818181818182211\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-05\",\n",
       "                    5.818181818182211\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-12\",\n",
       "                    6.818181818182211\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-19\",\n",
       "                    1.818181818182211\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-26\",\n",
       "                    2.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-02\",\n",
       "                    -50.263157894735855\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-09\",\n",
       "                    11.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-16\",\n",
       "                    12.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-23\",\n",
       "                    13.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-30\",\n",
       "                    13.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-07\",\n",
       "                    14.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-14\",\n",
       "                    7.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-21\",\n",
       "                    11.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-28\",\n",
       "                    3.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-04\",\n",
       "                    -1.2631578947358548\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-11\",\n",
       "                    3.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-18\",\n",
       "                    5.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-25\",\n",
       "                    -37.263157894735855\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-02\",\n",
       "                    24.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-09\",\n",
       "                    -17.263157894735855\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-16\",\n",
       "                    -15.263157894735855\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-23\",\n",
       "                    5.736842105264145\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-30\",\n",
       "                    -11.263157894735855\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-01\",\n",
       "                    null\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-08\",\n",
       "                    -45.72727272727013\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-15\",\n",
       "                    -50.72727272727013\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-22\",\n",
       "                    -54.72727272727013\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-29\",\n",
       "                    -54.72727272727013\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-05\",\n",
       "                    -48.72727272727013\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-12\",\n",
       "                    -51.72727272727013\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-19\",\n",
       "                    -1.7272727272701331\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-26\",\n",
       "                    -6.727272727270133\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-05\",\n",
       "                    20.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-12\",\n",
       "                    21.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-19\",\n",
       "                    22.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-26\",\n",
       "                    28.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-02\",\n",
       "                    38.27272727272987\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-09\",\n",
       "                    30.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-16\",\n",
       "                    29.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-23\",\n",
       "                    20.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-30\",\n",
       "                    15.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-07\",\n",
       "                    10.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-14\",\n",
       "                    10.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-21\",\n",
       "                    17.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-28\",\n",
       "                    36.27272727272987\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-04\",\n",
       "                    15.272727272729867\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-11\",\n",
       "                    -7.999999999997726\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-18\",\n",
       "                    -5.999999999997726\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-25\",\n",
       "                    5.000000000002274\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-02\",\n",
       "                    -42.999999999997726\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-09\",\n",
       "                    13.000000000002274\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-16\",\n",
       "                    8.000000000002274\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-23\",\n",
       "                    9.000000000002274\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-30\",\n",
       "                    9.000000000002274\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-06\",\n",
       "                    8.000000000002274\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-13\",\n",
       "                    7.000000000002274\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-20\",\n",
       "                    -1.9999999999977263\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-27\",\n",
       "                    21.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-03\",\n",
       "                    12.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-10\",\n",
       "                    17.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-17\",\n",
       "                    17.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-24\",\n",
       "                    16.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-01\",\n",
       "                    21.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-08\",\n",
       "                    20.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-15\",\n",
       "                    19.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-22\",\n",
       "                    20.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-29\",\n",
       "                    21.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-05\",\n",
       "                    23.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-12\",\n",
       "                    29.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-19\",\n",
       "                    29.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-26\",\n",
       "                    45.42105263158135\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-03\",\n",
       "                    29.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-10\",\n",
       "                    -0.5789473684186532\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-17\",\n",
       "                    5.421052631581347\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-24\",\n",
       "                    -182.57894736841865\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-31\",\n",
       "                    -167.57894736841865\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-02\",\n",
       "                    -9.434782608695969\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-09\",\n",
       "                    -50.43478260869597\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-16\",\n",
       "                    -51.43478260869597\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-23\",\n",
       "                    -55.43478260869597\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-30\",\n",
       "                    -52.43478260869597\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-06\",\n",
       "                    -51.43478260869597\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-13\",\n",
       "                    -34.43478260869597\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-20\",\n",
       "                    -3.4347826086959685\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-27\",\n",
       "                    -7.4347826086959685\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-06\",\n",
       "                    19.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-13\",\n",
       "                    21.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-20\",\n",
       "                    17.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-27\",\n",
       "                    24.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-03\",\n",
       "                    39.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-10\",\n",
       "                    36.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-17\",\n",
       "                    35.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-24\",\n",
       "                    23.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-01\",\n",
       "                    11.565217391304031\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-08\",\n",
       "                    12.565217391304031\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-15\",\n",
       "                    14.565217391304031\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-22\",\n",
       "                    19.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-29\",\n",
       "                    21.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-05\",\n",
       "                    17.56521739130403\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-12\",\n",
       "                    -11.545454545454504\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-19\",\n",
       "                    -9.545454545454504\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-26\",\n",
       "                    0.4545454545454959\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-03\",\n",
       "                    -11.545454545454504\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-10\",\n",
       "                    9.454545454545496\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-17\",\n",
       "                    6.454545454545496\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-24\",\n",
       "                    5.454545454545496\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-31\",\n",
       "                    6.454545454545496\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-07\",\n",
       "                    6.454545454545496\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-14\",\n",
       "                    2.454545454545496\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-21\",\n",
       "                    -4.545454545454504\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-28\",\n",
       "                    16.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-04\",\n",
       "                    -8.333333333333826\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-11\",\n",
       "                    -9.333333333333826\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-18\",\n",
       "                    15.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-25\",\n",
       "                    19.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-02\",\n",
       "                    18.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-09\",\n",
       "                    17.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-16\",\n",
       "                    17.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-23\",\n",
       "                    18.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-30\",\n",
       "                    16.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-06\",\n",
       "                    16.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-13\",\n",
       "                    19.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-20\",\n",
       "                    20.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-27\",\n",
       "                    57.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-04\",\n",
       "                    1.666666666666174\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-11\",\n",
       "                    -2.333333333333826\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-18\",\n",
       "                    -0.333333333333826\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-25\",\n",
       "                    -237.33333333333383\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-03\",\n",
       "                    -51.363636363635806\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-10\",\n",
       "                    -33.363636363635806\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-17\",\n",
       "                    -38.363636363635806\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-24\",\n",
       "                    -40.363636363635806\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-31\",\n",
       "                    -37.363636363635806\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-07\",\n",
       "                    -33.363636363635806\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-14\",\n",
       "                    -9.363636363635806\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-21\",\n",
       "                    -4.3636363636358055\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-28\",\n",
       "                    -1.3636363636358055\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-07\",\n",
       "                    14.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-14\",\n",
       "                    16.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-21\",\n",
       "                    14.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-28\",\n",
       "                    16.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-04\",\n",
       "                    19.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-11\",\n",
       "                    26.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-18\",\n",
       "                    26.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-25\",\n",
       "                    17.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-02\",\n",
       "                    17.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-09\",\n",
       "                    15.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-16\",\n",
       "                    16.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-23\",\n",
       "                    22.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-30\",\n",
       "                    23.636363636364194\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-06\",\n",
       "                    1.4166666666668561\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-13\",\n",
       "                    14.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-20\",\n",
       "                    20.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-27\",\n",
       "                    20.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-04\",\n",
       "                    -237.58333333333314\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-11\",\n",
       "                    31.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-18\",\n",
       "                    28.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-25\",\n",
       "                    28.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-01\",\n",
       "                    25.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-08\",\n",
       "                    26.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-15\",\n",
       "                    25.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-22\",\n",
       "                    15.416666666666856\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-29\",\n",
       "                    18.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-05\",\n",
       "                    8.666666666667311\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-12\",\n",
       "                    31.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-19\",\n",
       "                    31.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-26\",\n",
       "                    35.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-03\",\n",
       "                    34.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-10\",\n",
       "                    33.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-17\",\n",
       "                    34.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-24\",\n",
       "                    31.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-31\",\n",
       "                    -38.33333333333269\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-07\",\n",
       "                    30.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-14\",\n",
       "                    27.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-21\",\n",
       "                    39.66666666666731\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-28\",\n",
       "                    -326.3333333333327\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-05\",\n",
       "                    8.666666666667311\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-12\",\n",
       "                    7.666666666667311\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-19\",\n",
       "                    13.666666666667311\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-26\",\n",
       "                    -24.33333333333269\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-04\",\n",
       "                    -46.99999999999852\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-11\",\n",
       "                    -31.999999999998522\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-18\",\n",
       "                    -37.99999999999852\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-25\",\n",
       "                    -39.99999999999852\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-01\",\n",
       "                    -35.99999999999852\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-08\",\n",
       "                    -31.999999999998522\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-15\",\n",
       "                    -7.999999999998522\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-22\",\n",
       "                    -4.999999999998522\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-01\",\n",
       "                    -3.999999999998522\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-08\",\n",
       "                    17.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-15\",\n",
       "                    17.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-22\",\n",
       "                    15.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-29\",\n",
       "                    12.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-05\",\n",
       "                    19.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-12\",\n",
       "                    27.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-19\",\n",
       "                    26.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-26\",\n",
       "                    19.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-03\",\n",
       "                    16.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-10\",\n",
       "                    16.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-17\",\n",
       "                    18.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-24\",\n",
       "                    16.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-31\",\n",
       "                    24.000000000001478\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-07\",\n",
       "                    -4.833333333332803\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-14\",\n",
       "                    9.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-21\",\n",
       "                    13.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-28\",\n",
       "                    14.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-05\",\n",
       "                    -157.8333333333328\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-12\",\n",
       "                    22.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-19\",\n",
       "                    19.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-26\",\n",
       "                    19.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-02\",\n",
       "                    19.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-09\",\n",
       "                    19.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-16\",\n",
       "                    18.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-23\",\n",
       "                    9.166666666667197\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-30\",\n",
       "                    -0.888888888888232\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-06\",\n",
       "                    1.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-13\",\n",
       "                    30.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-20\",\n",
       "                    28.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-27\",\n",
       "                    30.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-04\",\n",
       "                    29.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-11\",\n",
       "                    25.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-18\",\n",
       "                    27.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-25\",\n",
       "                    23.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-01\",\n",
       "                    20.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-08\",\n",
       "                    20.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-15\",\n",
       "                    19.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-22\",\n",
       "                    33.11111111111177\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-29\",\n",
       "                    -304.88888888888823\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-06\",\n",
       "                    4.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-13\",\n",
       "                    4.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-20\",\n",
       "                    14.111111111111768\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-27\",\n",
       "                    -2.888888888888232\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-05\",\n",
       "                    -17.318181818180506\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-12\",\n",
       "                    -47.318181818180506\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-19\",\n",
       "                    -63.318181818180506\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-26\",\n",
       "                    -57.318181818180506\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-02\",\n",
       "                    -55.318181818180506\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-09\",\n",
       "                    -53.318181818180506\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-16\",\n",
       "                    0.6818181818194944\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-23\",\n",
       "                    5.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-02\",\n",
       "                    27.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-09\",\n",
       "                    27.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-16\",\n",
       "                    29.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-23\",\n",
       "                    29.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-30\",\n",
       "                    31.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-06\",\n",
       "                    32.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-13\",\n",
       "                    32.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-20\",\n",
       "                    28.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-27\",\n",
       "                    19.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-04\",\n",
       "                    7.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-11\",\n",
       "                    0.6818181818194944\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-18\",\n",
       "                    11.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-25\",\n",
       "                    -9.318181818180506\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-01\",\n",
       "                    16.681818181819494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-08\",\n",
       "                    -21.916666666665492\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-15\",\n",
       "                    0.0833333333345081\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-22\",\n",
       "                    11.083333333334508\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-29\",\n",
       "                    11.083333333334508\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-06\",\n",
       "                    4.083333333334508\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-13\",\n",
       "                    10.083333333334508\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-20\",\n",
       "                    9.083333333334508\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-27\",\n",
       "                    10.083333333334508\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-03\",\n",
       "                    8.083333333334508\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-10\",\n",
       "                    6.083333333334508\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-17\",\n",
       "                    -20.916666666665492\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-24\",\n",
       "                    -26.916666666665492\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-31\",\n",
       "                    -35.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-07\",\n",
       "                    -27.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-14\",\n",
       "                    -29.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-21\",\n",
       "                    -22.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-28\",\n",
       "                    -33.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-05\",\n",
       "                    -28.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-12\",\n",
       "                    -39.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-19\",\n",
       "                    -31.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-26\",\n",
       "                    -30.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-02\",\n",
       "                    -26.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-09\",\n",
       "                    -0.9999999999987494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-16\",\n",
       "                    -1.9999999999987494\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-23\",\n",
       "                    28.00000000000125\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-30\",\n",
       "                    141.00000000000125\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-07\",\n",
       "                    -24.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-14\",\n",
       "                    -23.99999999999875\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-21\",\n",
       "                    95.00000000000125\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-28\",\n",
       "                    98.00000000000125\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-06\",\n",
       "                    -40.22727272727252\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-13\",\n",
       "                    -44.22727272727252\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-20\",\n",
       "                    -86.22727272727252\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-01-27\",\n",
       "                    -49.22727272727252\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-03\",\n",
       "                    -58.22727272727252\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-10\",\n",
       "                    -43.22727272727252\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-17\",\n",
       "                    -24.22727272727252\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-02-24\",\n",
       "                    7.772727272727479\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-03\",\n",
       "                    40.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-10\",\n",
       "                    35.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-17\",\n",
       "                    34.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-24\",\n",
       "                    32.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-03-31\",\n",
       "                    24.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-07\",\n",
       "                    38.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-14\",\n",
       "                    44.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-21\",\n",
       "                    46.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-04-28\",\n",
       "                    40.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-05\",\n",
       "                    39.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-12\",\n",
       "                    23.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-19\",\n",
       "                    38.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-05-26\",\n",
       "                    -143.22727272727252\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-02\",\n",
       "                    38.77272727272748\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-09\",\n",
       "                    -14.16666666666697\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-16\",\n",
       "                    -4.16666666666697\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-23\",\n",
       "                    0.8333333333330302\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-06-30\",\n",
       "                    -4.16666666666697\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-07\",\n",
       "                    11.83333333333303\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-14\",\n",
       "                    8.83333333333303\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-21\",\n",
       "                    6.83333333333303\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-07-28\",\n",
       "                    7.83333333333303\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-04\",\n",
       "                    6.83333333333303\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-11\",\n",
       "                    6.83333333333303\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-18\",\n",
       "                    -8.16666666666697\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-08-25\",\n",
       "                    -19.16666666666697\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-01\",\n",
       "                    -176.55555555555588\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-08\",\n",
       "                    13.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-15\",\n",
       "                    5.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-22\",\n",
       "                    9.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-09-29\",\n",
       "                    19.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-06\",\n",
       "                    22.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-13\",\n",
       "                    7.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-20\",\n",
       "                    20.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-10-27\",\n",
       "                    15.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-03\",\n",
       "                    7.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-10\",\n",
       "                    0.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-17\",\n",
       "                    1.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-11-24\",\n",
       "                    1.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-01\",\n",
       "                    92.44444444444412\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-08\",\n",
       "                    -19.555555555555884\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-15\",\n",
       "                    -14.555555555555884\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-22\",\n",
       "                    0.444444444444116\n",
       "                ],\n",
       "                [\n",
       "                    \"2013-12-29\",\n",
       "                    -6.555555555555884\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"without_term\",\n",
       "                \"with_term\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"without_term\": true,\n",
       "                \"with_term\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"2013-01-07\",\n",
       "                \"2013-01-14\",\n",
       "                \"2013-01-21\",\n",
       "                \"2013-01-28\",\n",
       "                \"2013-02-04\",\n",
       "                \"2013-02-11\",\n",
       "                \"2013-02-18\",\n",
       "                \"2013-02-25\",\n",
       "                \"2013-03-04\",\n",
       "                \"2013-03-11\",\n",
       "                \"2013-03-18\",\n",
       "                \"2013-03-25\",\n",
       "                \"2013-04-01\",\n",
       "                \"2013-04-08\",\n",
       "                \"2013-04-15\",\n",
       "                \"2013-04-22\",\n",
       "                \"2013-04-29\",\n",
       "                \"2013-05-06\",\n",
       "                \"2013-05-13\",\n",
       "                \"2013-05-20\",\n",
       "                \"2013-05-27\",\n",
       "                \"2013-06-03\",\n",
       "                \"2013-06-10\",\n",
       "                \"2013-06-17\",\n",
       "                \"2013-06-24\",\n",
       "                \"2013-07-01\",\n",
       "                \"2013-07-08\",\n",
       "                \"2013-07-15\",\n",
       "                \"2013-07-22\",\n",
       "                \"2013-07-29\",\n",
       "                \"2013-08-05\",\n",
       "                \"2013-08-12\",\n",
       "                \"2013-08-19\",\n",
       "                \"2013-08-26\",\n",
       "                \"2013-09-02\",\n",
       "                \"2013-09-09\",\n",
       "                \"2013-09-16\",\n",
       "                \"2013-09-23\",\n",
       "                \"2013-09-30\",\n",
       "                \"2013-10-07\",\n",
       "                \"2013-10-14\",\n",
       "                \"2013-10-21\",\n",
       "                \"2013-10-28\",\n",
       "                \"2013-11-04\",\n",
       "                \"2013-11-11\",\n",
       "                \"2013-11-18\",\n",
       "                \"2013-11-25\",\n",
       "                \"2013-12-02\",\n",
       "                \"2013-12-09\",\n",
       "                \"2013-12-16\",\n",
       "                \"2013-12-23\",\n",
       "                \"2013-12-30\",\n",
       "                \"2013-01-01\",\n",
       "                \"2013-01-08\",\n",
       "                \"2013-01-15\",\n",
       "                \"2013-01-22\",\n",
       "                \"2013-01-29\",\n",
       "                \"2013-02-05\",\n",
       "                \"2013-02-12\",\n",
       "                \"2013-02-19\",\n",
       "                \"2013-02-26\",\n",
       "                \"2013-03-05\",\n",
       "                \"2013-03-12\",\n",
       "                \"2013-03-19\",\n",
       "                \"2013-03-26\",\n",
       "                \"2013-04-02\",\n",
       "                \"2013-04-09\",\n",
       "                \"2013-04-16\",\n",
       "                \"2013-04-23\",\n",
       "                \"2013-04-30\",\n",
       "                \"2013-05-07\",\n",
       "                \"2013-05-14\",\n",
       "                \"2013-05-21\",\n",
       "                \"2013-05-28\",\n",
       "                \"2013-06-04\",\n",
       "                \"2013-06-11\",\n",
       "                \"2013-06-18\",\n",
       "                \"2013-06-25\",\n",
       "                \"2013-07-02\",\n",
       "                \"2013-07-09\",\n",
       "                \"2013-07-16\",\n",
       "                \"2013-07-23\",\n",
       "                \"2013-07-30\",\n",
       "                \"2013-08-06\",\n",
       "                \"2013-08-13\",\n",
       "                \"2013-08-20\",\n",
       "                \"2013-08-27\",\n",
       "                \"2013-09-03\",\n",
       "                \"2013-09-10\",\n",
       "                \"2013-09-17\",\n",
       "                \"2013-09-24\",\n",
       "                \"2013-10-01\",\n",
       "                \"2013-10-08\",\n",
       "                \"2013-10-15\",\n",
       "                \"2013-10-22\",\n",
       "                \"2013-10-29\",\n",
       "                \"2013-11-05\",\n",
       "                \"2013-11-12\",\n",
       "                \"2013-11-19\",\n",
       "                \"2013-11-26\",\n",
       "                \"2013-12-03\",\n",
       "                \"2013-12-10\",\n",
       "                \"2013-12-17\",\n",
       "                \"2013-12-24\",\n",
       "                \"2013-12-31\",\n",
       "                \"2013-01-02\",\n",
       "                \"2013-01-09\",\n",
       "                \"2013-01-16\",\n",
       "                \"2013-01-23\",\n",
       "                \"2013-01-30\",\n",
       "                \"2013-02-06\",\n",
       "                \"2013-02-13\",\n",
       "                \"2013-02-20\",\n",
       "                \"2013-02-27\",\n",
       "                \"2013-03-06\",\n",
       "                \"2013-03-13\",\n",
       "                \"2013-03-20\",\n",
       "                \"2013-03-27\",\n",
       "                \"2013-04-03\",\n",
       "                \"2013-04-10\",\n",
       "                \"2013-04-17\",\n",
       "                \"2013-04-24\",\n",
       "                \"2013-05-01\",\n",
       "                \"2013-05-08\",\n",
       "                \"2013-05-15\",\n",
       "                \"2013-05-22\",\n",
       "                \"2013-05-29\",\n",
       "                \"2013-06-05\",\n",
       "                \"2013-06-12\",\n",
       "                \"2013-06-19\",\n",
       "                \"2013-06-26\",\n",
       "                \"2013-07-03\",\n",
       "                \"2013-07-10\",\n",
       "                \"2013-07-17\",\n",
       "                \"2013-07-24\",\n",
       "                \"2013-07-31\",\n",
       "                \"2013-08-07\",\n",
       "                \"2013-08-14\",\n",
       "                \"2013-08-21\",\n",
       "                \"2013-08-28\",\n",
       "                \"2013-09-04\",\n",
       "                \"2013-09-11\",\n",
       "                \"2013-09-18\",\n",
       "                \"2013-09-25\",\n",
       "                \"2013-10-02\",\n",
       "                \"2013-10-09\",\n",
       "                \"2013-10-16\",\n",
       "                \"2013-10-23\",\n",
       "                \"2013-10-30\",\n",
       "                \"2013-11-06\",\n",
       "                \"2013-11-13\",\n",
       "                \"2013-11-20\",\n",
       "                \"2013-11-27\",\n",
       "                \"2013-12-04\",\n",
       "                \"2013-12-11\",\n",
       "                \"2013-12-18\",\n",
       "                \"2013-12-25\",\n",
       "                \"2013-01-03\",\n",
       "                \"2013-01-10\",\n",
       "                \"2013-01-17\",\n",
       "                \"2013-01-24\",\n",
       "                \"2013-01-31\",\n",
       "                \"2013-02-07\",\n",
       "                \"2013-02-14\",\n",
       "                \"2013-02-21\",\n",
       "                \"2013-02-28\",\n",
       "                \"2013-03-07\",\n",
       "                \"2013-03-14\",\n",
       "                \"2013-03-21\",\n",
       "                \"2013-03-28\",\n",
       "                \"2013-04-04\",\n",
       "                \"2013-04-11\",\n",
       "                \"2013-04-18\",\n",
       "                \"2013-04-25\",\n",
       "                \"2013-05-02\",\n",
       "                \"2013-05-09\",\n",
       "                \"2013-05-16\",\n",
       "                \"2013-05-23\",\n",
       "                \"2013-05-30\",\n",
       "                \"2013-06-06\",\n",
       "                \"2013-06-13\",\n",
       "                \"2013-06-20\",\n",
       "                \"2013-06-27\",\n",
       "                \"2013-07-04\",\n",
       "                \"2013-07-11\",\n",
       "                \"2013-07-18\",\n",
       "                \"2013-07-25\",\n",
       "                \"2013-08-01\",\n",
       "                \"2013-08-08\",\n",
       "                \"2013-08-15\",\n",
       "                \"2013-08-22\",\n",
       "                \"2013-08-29\",\n",
       "                \"2013-09-05\",\n",
       "                \"2013-09-12\",\n",
       "                \"2013-09-19\",\n",
       "                \"2013-09-26\",\n",
       "                \"2013-10-03\",\n",
       "                \"2013-10-10\",\n",
       "                \"2013-10-17\",\n",
       "                \"2013-10-24\",\n",
       "                \"2013-10-31\",\n",
       "                \"2013-11-07\",\n",
       "                \"2013-11-14\",\n",
       "                \"2013-11-21\",\n",
       "                \"2013-11-28\",\n",
       "                \"2013-12-05\",\n",
       "                \"2013-12-12\",\n",
       "                \"2013-12-19\",\n",
       "                \"2013-12-26\",\n",
       "                \"2013-01-04\",\n",
       "                \"2013-01-11\",\n",
       "                \"2013-01-18\",\n",
       "                \"2013-01-25\",\n",
       "                \"2013-02-01\",\n",
       "                \"2013-02-08\",\n",
       "                \"2013-02-15\",\n",
       "                \"2013-02-22\",\n",
       "                \"2013-03-01\",\n",
       "                \"2013-03-08\",\n",
       "                \"2013-03-15\",\n",
       "                \"2013-03-22\",\n",
       "                \"2013-03-29\",\n",
       "                \"2013-04-05\",\n",
       "                \"2013-04-12\",\n",
       "                \"2013-04-19\",\n",
       "                \"2013-04-26\",\n",
       "                \"2013-05-03\",\n",
       "                \"2013-05-10\",\n",
       "                \"2013-05-17\",\n",
       "                \"2013-05-24\",\n",
       "                \"2013-05-31\",\n",
       "                \"2013-06-07\",\n",
       "                \"2013-06-14\",\n",
       "                \"2013-06-21\",\n",
       "                \"2013-06-28\",\n",
       "                \"2013-07-05\",\n",
       "                \"2013-07-12\",\n",
       "                \"2013-07-19\",\n",
       "                \"2013-07-26\",\n",
       "                \"2013-08-02\",\n",
       "                \"2013-08-09\",\n",
       "                \"2013-08-16\",\n",
       "                \"2013-08-23\",\n",
       "                \"2013-08-30\",\n",
       "                \"2013-09-06\",\n",
       "                \"2013-09-13\",\n",
       "                \"2013-09-20\",\n",
       "                \"2013-09-27\",\n",
       "                \"2013-10-04\",\n",
       "                \"2013-10-11\",\n",
       "                \"2013-10-18\",\n",
       "                \"2013-10-25\",\n",
       "                \"2013-11-01\",\n",
       "                \"2013-11-08\",\n",
       "                \"2013-11-15\",\n",
       "                \"2013-11-22\",\n",
       "                \"2013-11-29\",\n",
       "                \"2013-12-06\",\n",
       "                \"2013-12-13\",\n",
       "                \"2013-12-20\",\n",
       "                \"2013-12-27\",\n",
       "                \"2013-01-05\",\n",
       "                \"2013-01-12\",\n",
       "                \"2013-01-19\",\n",
       "                \"2013-01-26\",\n",
       "                \"2013-02-02\",\n",
       "                \"2013-02-09\",\n",
       "                \"2013-02-16\",\n",
       "                \"2013-02-23\",\n",
       "                \"2013-03-02\",\n",
       "                \"2013-03-09\",\n",
       "                \"2013-03-16\",\n",
       "                \"2013-03-23\",\n",
       "                \"2013-03-30\",\n",
       "                \"2013-04-06\",\n",
       "                \"2013-04-13\",\n",
       "                \"2013-04-20\",\n",
       "                \"2013-04-27\",\n",
       "                \"2013-05-04\",\n",
       "                \"2013-05-11\",\n",
       "                \"2013-05-18\",\n",
       "                \"2013-05-25\",\n",
       "                \"2013-06-01\",\n",
       "                \"2013-06-08\",\n",
       "                \"2013-06-15\",\n",
       "                \"2013-06-22\",\n",
       "                \"2013-06-29\",\n",
       "                \"2013-07-06\",\n",
       "                \"2013-07-13\",\n",
       "                \"2013-07-20\",\n",
       "                \"2013-07-27\",\n",
       "                \"2013-08-03\",\n",
       "                \"2013-08-10\",\n",
       "                \"2013-08-17\",\n",
       "                \"2013-08-24\",\n",
       "                \"2013-08-31\",\n",
       "                \"2013-09-07\",\n",
       "                \"2013-09-14\",\n",
       "                \"2013-09-21\",\n",
       "                \"2013-09-28\",\n",
       "                \"2013-10-05\",\n",
       "                \"2013-10-12\",\n",
       "                \"2013-10-19\",\n",
       "                \"2013-10-26\",\n",
       "                \"2013-11-02\",\n",
       "                \"2013-11-09\",\n",
       "                \"2013-11-16\",\n",
       "                \"2013-11-23\",\n",
       "                \"2013-11-30\",\n",
       "                \"2013-12-07\",\n",
       "                \"2013-12-14\",\n",
       "                \"2013-12-21\",\n",
       "                \"2013-12-28\",\n",
       "                \"2013-01-06\",\n",
       "                \"2013-01-13\",\n",
       "                \"2013-01-20\",\n",
       "                \"2013-01-27\",\n",
       "                \"2013-02-03\",\n",
       "                \"2013-02-10\",\n",
       "                \"2013-02-17\",\n",
       "                \"2013-02-24\",\n",
       "                \"2013-03-03\",\n",
       "                \"2013-03-10\",\n",
       "                \"2013-03-17\",\n",
       "                \"2013-03-24\",\n",
       "                \"2013-03-31\",\n",
       "                \"2013-04-07\",\n",
       "                \"2013-04-14\",\n",
       "                \"2013-04-21\",\n",
       "                \"2013-04-28\",\n",
       "                \"2013-05-05\",\n",
       "                \"2013-05-12\",\n",
       "                \"2013-05-19\",\n",
       "                \"2013-05-26\",\n",
       "                \"2013-06-02\",\n",
       "                \"2013-06-09\",\n",
       "                \"2013-06-16\",\n",
       "                \"2013-06-23\",\n",
       "                \"2013-06-30\",\n",
       "                \"2013-07-07\",\n",
       "                \"2013-07-14\",\n",
       "                \"2013-07-21\",\n",
       "                \"2013-07-28\",\n",
       "                \"2013-08-04\",\n",
       "                \"2013-08-11\",\n",
       "                \"2013-08-18\",\n",
       "                \"2013-08-25\",\n",
       "                \"2013-09-01\",\n",
       "                \"2013-09-08\",\n",
       "                \"2013-09-15\",\n",
       "                \"2013-09-22\",\n",
       "                \"2013-09-29\",\n",
       "                \"2013-10-06\",\n",
       "                \"2013-10-13\",\n",
       "                \"2013-10-20\",\n",
       "                \"2013-10-27\",\n",
       "                \"2013-11-03\",\n",
       "                \"2013-11-10\",\n",
       "                \"2013-11-17\",\n",
       "                \"2013-11-24\",\n",
       "                \"2013-12-01\",\n",
       "                \"2013-12-08\",\n",
       "                \"2013-12-15\",\n",
       "                \"2013-12-22\",\n",
       "                \"2013-12-29\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6b8b\\u5dee\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"type\": \"png\",\n",
       "                \"backgroundColor\": \"auto\",\n",
       "                \"connectedBackgroundColor\": \"#fff\",\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u4fdd\\u5b58\\u4e3a\\u56fe\\u7247\",\n",
       "                \"pixelRatio\": 1\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u8fd8\\u539f\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u6570\\u636e\\u89c6\\u56fe\",\n",
       "                \"readOnly\": false,\n",
       "                \"lang\": [\n",
       "                    \"\\u6570\\u636e\\u89c6\\u56fe\",\n",
       "                    \"\\u5173\\u95ed\",\n",
       "                    \"\\u5237\\u65b0\"\n",
       "                ],\n",
       "                \"backgroundColor\": \"#fff\",\n",
       "                \"textareaColor\": \"#fff\",\n",
       "                \"textareaBorderColor\": \"#333\",\n",
       "                \"textColor\": \"#000\",\n",
       "                \"buttonColor\": \"#c23531\",\n",
       "                \"buttonTextColor\": \"#fff\"\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"\\u533a\\u57df\\u7f29\\u653e\",\n",
       "                    \"back\": \"\\u533a\\u57df\\u7f29\\u653e\\u8fd8\\u539f\"\n",
       "                },\n",
       "                \"icon\": {},\n",
       "                \"xAxisIndex\": false,\n",
       "                \"yAxisIndex\": false,\n",
       "                \"filterMode\": \"filter\"\n",
       "            },\n",
       "            \"magicType\": {\n",
       "                \"show\": true,\n",
       "                \"type\": [\n",
       "                    \"line\",\n",
       "                    \"bar\",\n",
       "                    \"stack\",\n",
       "                    \"tiled\"\n",
       "                ],\n",
       "                \"title\": {\n",
       "                    \"line\": \"\\u5207\\u6362\\u4e3a\\u6298\\u7ebf\\u56fe\",\n",
       "                    \"bar\": \"\\u5207\\u6362\\u4e3a\\u67f1\\u72b6\\u56fe\",\n",
       "                    \"stack\": \"\\u5207\\u6362\\u4e3a\\u5806\\u53e0\",\n",
       "                    \"tiled\": \"\\u5207\\u6362\\u4e3a\\u5e73\\u94fa\"\n",
       "                },\n",
       "                \"icon\": {}\n",
       "            },\n",
       "            \"brush\": {\n",
       "                \"icon\": {},\n",
       "                \"title\": {\n",
       "                    \"rect\": \"\\u77e9\\u5f62\\u9009\\u62e9\",\n",
       "                    \"polygon\": \"\\u5708\\u9009\",\n",
       "                    \"lineX\": \"\\u6a2a\\u5411\\u9009\\u62e9\",\n",
       "                    \"lineY\": \"\\u7eb5\\u5411\\u9009\\u62e9\",\n",
       "                    \"keep\": \"\\u4fdd\\u6301\\u9009\\u62e9\",\n",
       "                    \"clear\": \"\\u6e05\\u9664\\u9009\\u62e9\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"dataZoom\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"type\": \"slider\",\n",
       "            \"realtime\": true,\n",
       "            \"start\": 0,\n",
       "            \"end\": 100,\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"zoomLock\": false,\n",
       "            \"filterMode\": \"filter\"\n",
       "        },\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"type\": \"slider\",\n",
       "            \"realtime\": true,\n",
       "            \"start\": 0,\n",
       "            \"end\": 100,\n",
       "            \"orient\": \"vertical\",\n",
       "            \"zoomLock\": false,\n",
       "            \"filterMode\": \"filter\"\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_dd14fea813ef4112b3c45e6d53daf48c.setOption(option_dd14fea813ef4112b3c45e6d53daf48c);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x29e18757640>"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(\n",
    "    Line(init_opts=opts.InitOpts(theme=ThemeType.CHALK))\n",
    "    .add_xaxis(xaxis_data = df_daily3['event_date'].dt.strftime('%Y-%m-%d').tolist())\n",
    "    .add_yaxis(\"without_term\", df_daily3['resid'].tolist())\n",
    "    .add_yaxis(\"with_term\", df_daily5['resid'].tolist())\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"残差\"),\n",
    "        toolbox_opts=opts.ToolboxOpts(), # 工具箱\n",
    "        datazoom_opts=[opts.DataZoomOpts(is_realtime=True, range_start=0, range_end=100), \n",
    "                       opts.DataZoomOpts(orient=\"vertical\", range_start=0, range_end=100)], # 同时添加水平和垂直滑动条\n",
    "    )\n",
    "    .render_notebook()\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "从上图可以看到，分段拟合后，残差显著减低了。 接下来在原数据的基础上叠加预测值。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"gFJzXq\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"weekday\":[\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\"],\n",
       "\"term\":[\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",null,\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\"],\n",
       "\"pred\":[961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,961.2727272727269,994.1818181818178,994.1818181818178,994.1818181818178,994.1818181818178,994.1818181818178,994.1818181818178,994.1818181818178,994.1818181818178,994.1818181818178,994.1818181818178,994.1818181818178,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,979.2631578947359,null,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,944.7272727272701,987.9999999999977,987.9999999999977,987.9999999999977,987.9999999999977,987.9999999999977,987.9999999999977,987.9999999999977,987.9999999999977,987.9999999999977,987.9999999999977,987.9999999999977,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,943.5789473684187,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,952.434782608696,994.5454545454545,994.5454545454545,994.5454545454545,994.5454545454545,994.5454545454545,994.5454545454545,994.5454545454545,994.5454545454545,994.5454545454545,994.5454545454545,994.5454545454545,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,956.3333333333338,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,965.3636363636358,974.5833333333331,974.5833333333331,974.5833333333331,974.5833333333331,974.5833333333331,974.5833333333331,974.5833333333331,974.5833333333331,974.5833333333331,974.5833333333331,974.5833333333331,974.5833333333331,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,960.3333333333327,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,961.9999999999985,979.8333333333328,979.8333333333328,979.8333333333328,979.8333333333328,979.8333333333328,979.8333333333328,979.8333333333328,979.8333333333328,979.8333333333328,979.8333333333328,979.8333333333328,979.8333333333328,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,965.8888888888882,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,737.3181818181805,800.9166666666655,800.9166666666655,800.9166666666655,800.9166666666655,800.9166666666655,800.9166666666655,800.9166666666655,800.9166666666655,800.9166666666655,800.9166666666655,800.9166666666655,800.9166666666655,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,715.9999999999987,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,872.2272727272725,922.166666666667,922.166666666667,922.166666666667,922.166666666667,922.166666666667,922.166666666667,922.166666666667,922.166666666667,922.166666666667,922.166666666667,922.166666666667,922.166666666667,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559,894.5555555555559]\n",
       "},\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"facet\":{\n",
       "\"name\":\"wrap\",\n",
       "\"facets\":\"term\",\n",
       "\"nrow\":1,\n",
       "\"order\":1,\n",
       "\"dir\":\"h\"\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":900,\n",
       "\"height\":300\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"geom\":\"boxplot\",\n",
       "\"mapping\":{\n",
       "\"x\":\"weekday\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"#4169E1\",\n",
       "\"size\":1,\n",
       "\"data\":{\n",
       "\"..middle..\":[NaN,NaN,985.0,NaN,NaN,NaN,NaN,964.0,NaN,NaN,973.0,NaN,NaN,989.5,NaN,986.0,NaN,NaN,NaN,690.0,NaN,NaN,901.0,977.5,960.0,967.0,980.5,977.5,747.0,901.0,NaN,999.0,NaN,995.0,997.0,NaN,997.5,NaN,996.0,808.0,926.0],\n",
       "\"..lower..\":[NaN,NaN,973.0,NaN,NaN,NaN,NaN,958.0,NaN,NaN,957.0,NaN,NaN,969.0,NaN,970.0,NaN,NaN,NaN,685.5,NaN,NaN,895.0,932.5,918.5,930.5,944.0,942.0,724.0,830.5,NaN,992.0,NaN,984.0,987.5,NaN,989.5,NaN,989.0,790.5,916.0],\n",
       "\"..upper..\":[NaN,NaN,991.5,NaN,NaN,NaN,NaN,966.0,NaN,NaN,975.0,NaN,NaN,993.0,NaN,993.5,NaN,NaN,NaN,714.5,NaN,NaN,909.0,981.0,966.5,974.0,983.0,979.5,765.5,911.0,NaN,1000.0,NaN,996.5,1001.0,NaN,1002.0,NaN,999.0,811.0,929.5],\n",
       "\"..ymin..\":[NaN,NaN,962.0,NaN,NaN,NaN,NaN,949.0,NaN,NaN,947.0,NaN,NaN,936.0,NaN,963.0,NaN,NaN,NaN,676.0,NaN,NaN,875.0,912.0,890.0,897.0,914.0,915.0,674.0,729.0,NaN,987.0,NaN,980.0,983.0,NaN,976.0,NaN,975.0,774.0,903.0],\n",
       "\"..ymax..\":[NaN,NaN,1004.0,NaN,NaN,NaN,NaN,973.0,NaN,NaN,977.0,NaN,NaN,1000.0,NaN,999.0,NaN,NaN,NaN,744.0,NaN,NaN,917.0,995.0,983.0,992.0,992.0,989.0,770.0,919.0,NaN,1004.0,NaN,1001.0,1004.0,NaN,1006.0,NaN,1002.0,812.0,934.0],\n",
       "\"term\":[\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\"],\n",
       "\"weekday\":[\"周一\",\"周一\",\"周一\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周三\",\"周三\",\"周三\",\"周四\",\"周四\",\"周四\",\"周五\",\"周五\",\"周六\",\"周六\",\"周六\",\"周六\",\"周日\",\"周日\",\"周日\",\"周一\",\"周二\",\"周三\",\"周四\",\"周五\",\"周六\",\"周日\",\"周一\",\"周一\",\"周二\",\"周二\",\"周三\",\"周四\",\"周四\",\"周五\",\"周五\",\"周六\",\"周日\"],\n",
       "\"y\":[929.0,942.0,NaN,989.0,943.0,761.0,776.0,NaN,1014.0,719.0,NaN,922.0,634.0,NaN,661.0,NaN,857.0,811.0,814.0,NaN,718.0,987.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,966.0,NaN,945.0,NaN,NaN,737.0,NaN,822.0,NaN,NaN,NaN]\n",
       "}\n",
       "},{\n",
       "\"geom\":\"point\",\n",
       "\"mapping\":{\n",
       "\"x\":\"weekday\",\n",
       "\"y\":\"pred\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"#FF00FF\",\n",
       "\"size\":3,\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"gFJzXq\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e18757e50>"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily5) \\\n",
    "+ geom_boxplot(aes(x='weekday', y='y'), color='#4169E1', size=1) \\\n",
    "+ geom_point(aes(x='weekday', y='pred'), color='#FF00FF', size=3) \\\n",
    "+ facet_wrap(facets='term', nrow=1) \\\n",
    "+ ggsize(900, 300)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "从上图来看，存在显著的均值效应(均值线距离箱线图矩形中心较远)，这是由于离群值导致的， 离群值也会使预测值发生偏移。因此可以使用鲁棒回归， 以便显著假降低离群值的影响。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 鲁棒回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                    Robust linear Model Regression Results                    \n",
      "==============================================================================\n",
      "Dep. Variable:                      y   No. Observations:                  364\n",
      "Model:                            RLM   Df Residuals:                      343\n",
      "Method:                          IRLS   Df Model:                           20\n",
      "Norm:                          HuberT                                         \n",
      "Scale Est.:                       mad                                         \n",
      "Cov Type:                          H1                                         \n",
      "Date:                Tue, 09 Nov 2021                                         \n",
      "Time:                        15:38:49                                         \n",
      "No. Iterations:                    31                                         \n",
      "================================================================================================\n",
      "                                   coef    std err          z      P>|z|      [0.025      0.975]\n",
      "------------------------------------------------------------------------------------------------\n",
      "Intercept                      966.3307      4.158    232.421      0.000     958.182     974.480\n",
      "weekday[T.周二]                  -11.6816      5.880     -1.987      0.047     -23.206      -0.157\n",
      "weekday[T.周三]                   -5.7368      5.816     -0.986      0.324     -17.135       5.662\n",
      "weekday[T.周四]                    4.9587      5.880      0.843      0.399      -6.566      16.483\n",
      "weekday[T.周五]                    1.0212      5.880      0.174      0.862     -10.503      12.545\n",
      "weekday[T.周六]                 -219.3538      5.880    -37.306      0.000    -230.878    -207.830\n",
      "weekday[T.周日]                  -72.6116      5.880    -12.349      0.000     -84.136     -61.087\n",
      "term[T.summer]                  28.3465      7.201      3.936      0.000      14.232      42.461\n",
      "term[T.fall]                    15.3483      6.108      2.513      0.012       3.378      27.319\n",
      "weekday[T.周二]:term[T.summer]     6.9816     10.184      0.686      0.493     -12.979      26.942\n",
      "weekday[T.周三]:term[T.summer]     5.6051     10.147      0.552      0.581     -14.283      25.493\n",
      "weekday[T.周四]:term[T.summer]    -5.5657     10.042     -0.554      0.579     -25.247      14.116\n",
      "weekday[T.周五]:term[T.summer]    -3.6282     10.042     -0.361      0.718     -23.310      16.053\n",
      "weekday[T.周六]:term[T.summer]    25.9286     10.042      2.582      0.010       6.247      45.610\n",
      "weekday[T.周日]:term[T.summer]     0.1011     10.042      0.010      0.992     -19.580      19.782\n",
      "weekday[T.周二]:term[T.fall]      -8.8241      8.637     -1.022      0.307     -25.753       8.105\n",
      "weekday[T.周三]:term[T.fall]      -8.3797      8.658     -0.968      0.333     -25.349       8.590\n",
      "weekday[T.周四]:term[T.fall]      -5.0167      8.701     -0.577      0.564     -22.071      12.038\n",
      "weekday[T.周五]:term[T.fall]      -0.2430      8.701     -0.028      0.978     -17.298      16.812\n",
      "weekday[T.周六]:term[T.fall]     -65.5456      8.701     -7.533      0.000     -82.600     -48.491\n",
      "weekday[T.周日]:term[T.fall]      -9.1493      8.701     -1.051      0.293     -26.204       7.905\n",
      "================================================================================================\n",
      "\n",
      "If the model instance has been used for another fit with different fit parameters, then the fit options might not be the correct ones anymore .\n"
     ]
    }
   ],
   "source": [
    "mod3 = smf.rlm('y ~ weekday * term', data=df_daily4).fit()\n",
    "print(mod3.summary())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x</th>\n",
       "      <th>event_date</th>\n",
       "      <th>y</th>\n",
       "      <th>weekday</th>\n",
       "      <th>term</th>\n",
       "      <th>pred</th>\n",
       "      <th>resid</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-07</td>\n",
       "      <td>933</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>966.33066</td>\n",
       "      <td>-33.33066</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-14</td>\n",
       "      <td>928</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>966.33066</td>\n",
       "      <td>-38.33066</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-21</td>\n",
       "      <td>912</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>966.33066</td>\n",
       "      <td>-54.33066</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-28</td>\n",
       "      <td>923</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>966.33066</td>\n",
       "      <td>-43.33066</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-02-04</td>\n",
       "      <td>932</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>966.33066</td>\n",
       "      <td>-34.33066</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   x event_date    y weekday    term       pred     resid\n",
       "0  0 2013-01-07  933      周一  spring  966.33066 -33.33066\n",
       "1  0 2013-01-14  928      周一  spring  966.33066 -38.33066\n",
       "2  0 2013-01-21  912      周一  spring  966.33066 -54.33066\n",
       "3  0 2013-01-28  923      周一  spring  966.33066 -43.33066\n",
       "4  0 2013-02-04  932      周一  spring  966.33066 -34.33066"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_daily6 = df_daily4.copy()\n",
    "df_daily6['pred'] = mod3.fittedvalues # 预测值\n",
    "df_daily6['resid'] = df_daily6['y']  - df_daily6['pred'] # 残差\n",
    "df_daily6.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"ZNEWKP\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"event_date\":[1.3575168E12,1.3581216E12,1.3587264E12,1.3593312E12,1.359936E12,1.3605408E12,1.3611456E12,1.3617504E12,1.3623552E12,1.36296E12,1.3635648E12,1.3641696E12,1.3647744E12,1.3653792E12,1.365984E12,1.3665888E12,1.3671936E12,1.3677984E12,1.3684032E12,1.369008E12,1.3696128E12,1.3702176E12,1.3708224E12,1.3714272E12,1.372032E12,1.3726368E12,1.3732416E12,1.3738464E12,1.3744512E12,1.375056E12,1.3756608E12,1.3762656E12,1.3768704E12,1.3774752E12,1.37808E12,1.3786848E12,1.3792896E12,1.3798944E12,1.3804992E12,1.381104E12,1.3817088E12,1.3823136E12,1.3829184E12,1.3835232E12,1.384128E12,1.3847328E12,1.3853376E12,1.3859424E12,1.3865472E12,1.387152E12,1.3877568E12,1.3883616E12,1.3569984E12,1.3576032E12,1.358208E12,1.3588128E12,1.3594176E12,1.3600224E12,1.3606272E12,1.361232E12,1.3618368E12,1.3624416E12,1.3630464E12,1.3636512E12,1.364256E12,1.3648608E12,1.3654656E12,1.3660704E12,1.3666752E12,1.36728E12,1.3678848E12,1.3684896E12,1.3690944E12,1.3696992E12,1.370304E12,1.3709088E12,1.3715136E12,1.3721184E12,1.3727232E12,1.373328E12,1.3739328E12,1.3745376E12,1.3751424E12,1.3757472E12,1.376352E12,1.3769568E12,1.3775616E12,1.3781664E12,1.3787712E12,1.379376E12,1.3799808E12,1.3805856E12,1.3811904E12,1.3817952E12,1.3824E12,1.3830048E12,1.3836096E12,1.3842144E12,1.3848192E12,1.385424E12,1.3860288E12,1.3866336E12,1.3872384E12,1.3878432E12,1.388448E12,1.3570848E12,1.3576896E12,1.3582944E12,1.3588992E12,1.359504E12,1.3601088E12,1.3607136E12,1.3613184E12,1.3619232E12,1.362528E12,1.3631328E12,1.3637376E12,1.3643424E12,1.3649472E12,1.365552E12,1.3661568E12,1.3667616E12,1.3673664E12,1.3679712E12,1.368576E12,1.3691808E12,1.3697856E12,1.3703904E12,1.3709952E12,1.3716E12,1.3722048E12,1.3728096E12,1.3734144E12,1.3740192E12,1.374624E12,1.3752288E12,1.3758336E12,1.3764384E12,1.3770432E12,1.377648E12,1.3782528E12,1.3788576E12,1.3794624E12,1.3800672E12,1.380672E12,1.3812768E12,1.3818816E12,1.3824864E12,1.3830912E12,1.383696E12,1.3843008E12,1.3849056E12,1.3855104E12,1.3861152E12,1.38672E12,1.3873248E12,1.3879296E12,1.3571712E12,1.357776E12,1.3583808E12,1.3589856E12,1.3595904E12,1.3601952E12,1.3608E12,1.3614048E12,1.3620096E12,1.3626144E12,1.3632192E12,1.363824E12,1.3644288E12,1.3650336E12,1.3656384E12,1.3662432E12,1.366848E12,1.3674528E12,1.3680576E12,1.3686624E12,1.3692672E12,1.369872E12,1.3704768E12,1.3710816E12,1.3716864E12,1.3722912E12,1.372896E12,1.3735008E12,1.3741056E12,1.3747104E12,1.3753152E12,1.37592E12,1.3765248E12,1.3771296E12,1.3777344E12,1.3783392E12,1.378944E12,1.3795488E12,1.3801536E12,1.3807584E12,1.3813632E12,1.381968E12,1.3825728E12,1.3831776E12,1.3837824E12,1.3843872E12,1.384992E12,1.3855968E12,1.3862016E12,1.3868064E12,1.3874112E12,1.388016E12,1.3572576E12,1.3578624E12,1.3584672E12,1.359072E12,1.3596768E12,1.3602816E12,1.3608864E12,1.3614912E12,1.362096E12,1.3627008E12,1.3633056E12,1.3639104E12,1.3645152E12,1.36512E12,1.3657248E12,1.3663296E12,1.3669344E12,1.3675392E12,1.368144E12,1.3687488E12,1.3693536E12,1.3699584E12,1.3705632E12,1.371168E12,1.3717728E12,1.3723776E12,1.3729824E12,1.3735872E12,1.374192E12,1.3747968E12,1.3754016E12,1.3760064E12,1.3766112E12,1.377216E12,1.3778208E12,1.3784256E12,1.3790304E12,1.3796352E12,1.38024E12,1.3808448E12,1.3814496E12,1.3820544E12,1.3826592E12,1.383264E12,1.3838688E12,1.3844736E12,1.3850784E12,1.3856832E12,1.386288E12,1.3868928E12,1.3874976E12,1.3881024E12,1.357344E12,1.3579488E12,1.3585536E12,1.3591584E12,1.3597632E12,1.360368E12,1.3609728E12,1.3615776E12,1.3621824E12,1.3627872E12,1.363392E12,1.3639968E12,1.3646016E12,1.3652064E12,1.3658112E12,1.366416E12,1.3670208E12,1.3676256E12,1.3682304E12,1.3688352E12,1.36944E12,1.3700448E12,1.3706496E12,1.3712544E12,1.3718592E12,1.372464E12,1.3730688E12,1.3736736E12,1.3742784E12,1.3748832E12,1.375488E12,1.3760928E12,1.3766976E12,1.3773024E12,1.3779072E12,1.378512E12,1.3791168E12,1.3797216E12,1.3803264E12,1.3809312E12,1.381536E12,1.3821408E12,1.3827456E12,1.3833504E12,1.3839552E12,1.38456E12,1.3851648E12,1.3857696E12,1.3863744E12,1.3869792E12,1.387584E12,1.3881888E12,1.3574304E12,1.3580352E12,1.35864E12,1.3592448E12,1.3598496E12,1.3604544E12,1.3610592E12,1.361664E12,1.3622688E12,1.3628736E12,1.3634784E12,1.3640832E12,1.364688E12,1.3652928E12,1.3658976E12,1.3665024E12,1.3671072E12,1.367712E12,1.3683168E12,1.3689216E12,1.3695264E12,1.3701312E12,1.370736E12,1.3713408E12,1.3719456E12,1.3725504E12,1.3731552E12,1.37376E12,1.3743648E12,1.3749696E12,1.3755744E12,1.3761792E12,1.376784E12,1.3773888E12,1.3779936E12,1.3785984E12,1.3792032E12,1.379808E12,1.3804128E12,1.3810176E12,1.3816224E12,1.3822272E12,1.382832E12,1.3834368E12,1.3840416E12,1.3846464E12,1.3852512E12,1.385856E12,1.3864608E12,1.3870656E12,1.3876704E12,1.3882752E12],\n",
       "\"resid\":[-33.33066047597788,-38.33066047597788,-54.33066047597788,-43.33066047597788,-34.33066047597788,-37.33066047597788,-18.33066047597788,-5.330660475977879,10.66933952402212,13.66933952402212,14.66933952402212,11.66933952402212,3.6693395240221207,14.66933952402212,28.66933952402212,18.66933952402212,16.66933952402212,13.66933952402212,12.66933952402212,16.66933952402212,-38.33066047597788,15.66933952402212,-7.677154468192043,-4.677154468192043,-0.6771544681920432,-28.677154468192043,9.322845531807957,4.322845531807957,5.322845531807957,4.322845531807957,5.322845531807957,6.322845531807957,1.3228455318079568,0.3209947452878623,-52.67900525471214,9.320994745287862,10.320994745287862,11.320994745287862,11.320994745287862,12.320994745287862,5.320994745287862,9.320994745287862,1.3209947452878623,-3.6790052547121377,1.3209947452878623,3.3209947452878623,-39.67900525471214,22.320994745287862,-19.679005254712138,-17.679005254712138,3.3209947452878623,-13.679005254712138,null,-55.649012317422944,-60.649012317422944,-64.64901231742294,-64.64901231742294,-58.649012317422944,-61.649012317422944,-11.649012317422944,-16.649012317422944,10.350987682577056,11.350987682577056,12.350987682577056,18.350987682577056,28.350987682577056,20.350987682577056,19.350987682577056,10.350987682577056,5.350987682577056,0.35098768257705615,0.35098768257705615,7.350987682577056,26.350987682577056,5.350987682577056,-9.977154465461126,-7.977154465461126,3.022845534538874,-44.977154465461126,11.022845534538874,6.022845534538874,7.022845534538874,7.022845534538874,6.022845534538874,5.022845534538874,-3.977154465461126,3.8267784579987847,-5.173221542001215,-0.1732215420012153,-0.1732215420012153,-1.1732215420012153,3.8267784579987847,2.8267784579987847,1.8267784579987847,2.8267784579987847,3.8267784579987847,5.826778457998785,11.826778457998785,11.826778457998785,27.826778457998785,11.826778457998785,-18.173221542001215,-12.173221542001215,-200.17322154200122,-185.17322154200122,-17.593901724189436,-58.593901724189436,-59.593901724189436,-63.593901724189436,-60.593901724189436,-59.593901724189436,-42.593901724189436,-11.593901724189436,-15.593901724189436,11.406098275810564,13.406098275810564,9.406098275810564,16.406098275810564,31.406098275810564,28.406098275810564,27.406098275810564,15.406098275810564,3.406098275810564,4.406098275810564,6.406098275810564,11.406098275810564,13.406098275810564,9.406098275810564,-11.545454545455414,-9.545454545455414,0.4545454545445864,-11.545454545455414,9.454545454544586,6.454545454544586,5.454545454544586,6.454545454544586,6.454545454544586,2.4545454545445864,-4.545454545455414,5.4374999999990905,-19.56250000000091,-20.56250000000091,4.4374999999990905,8.43749999999909,7.4374999999990905,6.4374999999990905,6.4374999999990905,7.4374999999990905,5.4374999999990905,5.4374999999990905,8.43749999999909,9.43749999999909,46.43749999999909,-9.56250000000091,-13.56250000000091,-11.56250000000091,-248.5625000000009,-57.2893291293143,-39.2893291293143,-44.2893291293143,-46.2893291293143,-43.2893291293143,-39.2893291293143,-15.289329129314297,-10.289329129314297,-7.2893291293142966,8.710670870685703,10.710670870685703,8.710670870685703,10.710670870685703,13.710670870685703,20.710670870685703,20.710670870685703,11.710670870685703,11.710670870685703,9.710670870685703,10.710670870685703,16.710670870685703,17.710670870685703,-18.070140416831805,-5.070140416831805,0.9298595831681951,0.9298595831681951,-257.0701404168318,11.929859583168195,8.929859583168195,8.929859583168195,5.929859583168195,6.929859583168195,5.929859583168195,-4.070140416831805,-2.62097560051609,-12.62097560051609,10.37902439948391,10.37902439948391,14.37902439948391,13.37902439948391,12.37902439948391,13.37902439948391,10.37902439948391,-59.62097560051609,9.37902439948391,6.37902439948391,18.37902439948391,-347.6209756005161,-12.62097560051609,-13.62097560051609,-7.62097560051609,-45.62097560051609,-52.351829100421355,-37.351829100421355,-43.351829100421355,-45.351829100421355,-41.351829100421355,-37.351829100421355,-13.351829100421355,-10.351829100421355,-9.351829100421355,11.648170899578645,11.648170899578645,9.648170899578645,6.648170899578645,13.648170899578645,21.648170899578645,20.648170899578645,13.648170899578645,10.648170899578645,10.648170899578645,12.648170899578645,10.648170899578645,18.648170899578645,-17.07014041751779,-3.0701404175177913,0.9298595824822087,1.9298595824822087,-170.0701404175178,9.929859582482209,6.929859582482209,6.929859582482209,6.929859582482209,6.929859582482209,5.929859582482209,-3.0701404175177913,-17.457149681054602,-15.457149681054602,13.542850318945398,11.542850318945398,13.542850318945398,12.542850318945398,8.542850318945398,10.542850318945398,6.542850318945398,3.5428503189453977,3.5428503189453977,2.5428503189453977,16.542850318945398,-321.4571496810546,-12.457149681054602,-12.457149681054602,-2.4571496810546023,-19.457149681054602,-26.976829201121404,-56.976829201121404,-72.9768292011214,-66.9768292011214,-64.9768292011214,-62.976829201121404,-8.976829201121404,-3.9768292011214044,18.023170798878596,18.023170798878596,20.023170798878596,20.023170798878596,22.023170798878596,23.023170798878596,23.023170798878596,19.023170798878596,10.023170798878596,-1.9768292011214044,-8.976829201121404,2.0231707988785956,-18.976829201121404,7.023170798878596,-22.251958607268193,-0.2519586072681932,10.748041392731807,10.748041392731807,3.748041392731807,9.748041392731807,8.748041392731807,9.748041392731807,7.748041392731807,5.748041392731807,-21.251958607268193,-27.251958607268193,-16.779558663506805,-8.779558663506805,-10.779558663506805,-3.779558663506805,-14.779558663506805,-9.779558663506805,-20.779558663506805,-12.779558663506805,-11.779558663506805,-7.779558663506805,18.220441336493195,17.220441336493195,47.220441336493195,160.2204413364932,-5.779558663506805,-4.779558663506805,114.2204413364932,117.2204413364932,-61.719103536596776,-65.71910353659678,-107.71910353659678,-70.71910353659678,-79.71910353659678,-64.71910353659678,-45.719103536596776,-13.719103536596776,19.280896463403224,14.280896463403224,13.280896463403224,11.280896463403224,3.2808964634032236,17.280896463403224,23.280896463403224,25.280896463403224,19.280896463403224,18.280896463403224,2.2808964634032236,17.280896463403224,-164.71910353659678,17.280896463403224,-14.166666666667197,-4.166666666667197,0.8333333333328028,-4.166666666667197,11.833333333332803,8.833333333332803,6.833333333332803,7.833333333332803,6.833333333332803,6.833333333332803,-8.166666666667197,-19.166666666667197,-181.91810297897803,8.081897021021973,0.08189702102197316,4.081897021021973,14.081897021021973,17.081897021021973,2.081897021021973,15.081897021021973,10.081897021021973,2.081897021021973,-4.918102978978027,-3.918102978978027,-3.918102978978027,87.08189702102197,-24.918102978978027,-19.918102978978027,-4.918102978978027,-11.918102978978027]\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"resid\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":800,\n",
       "\"height\":400\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"format\":\"%Y-%m-%d\",\n",
       "\"datetime\":true\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"geom\":\"hline\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"yintercept\":0,\n",
       "\"size\":3,\n",
       "\"color\":\"yellow\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"gray\",\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"ZNEWKP\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e1871c850>"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily6, aes(x='event_date', y='resid')) \\\n",
    "+ geom_hline(yintercept=0, size=3, color='yellow') \\\n",
    "+ geom_line(color='gray') \\\n",
    "+ scale_x_datetime(format='%Y-%m-%d') \\\n",
    "+ ggsize(800, 400)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"XnEbgS\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"weekday\":[\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周一\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周三\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周四\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周五\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周六\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\",\"周日\"],\n",
       "\"term\":[\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",null,\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\"],\n",
       "\"pred\":[966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,null,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978]\n",
       "},\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"facet\":{\n",
       "\"name\":\"wrap\",\n",
       "\"facets\":\"term\",\n",
       "\"nrow\":1,\n",
       "\"order\":1,\n",
       "\"dir\":\"h\"\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":1000,\n",
       "\"height\":300\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"geom\":\"boxplot\",\n",
       "\"mapping\":{\n",
       "\"x\":\"weekday\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"#4169E1\",\n",
       "\"size\":1,\n",
       "\"data\":{\n",
       "\"..middle..\":[NaN,NaN,985.0,NaN,NaN,NaN,NaN,964.0,NaN,NaN,973.0,NaN,NaN,989.5,NaN,986.0,NaN,NaN,NaN,690.0,NaN,NaN,901.0,977.5,960.0,967.0,980.5,977.5,747.0,901.0,NaN,999.0,NaN,995.0,997.0,NaN,997.5,NaN,996.0,808.0,926.0],\n",
       "\"..lower..\":[NaN,NaN,973.0,NaN,NaN,NaN,NaN,958.0,NaN,NaN,957.0,NaN,NaN,969.0,NaN,970.0,NaN,NaN,NaN,685.5,NaN,NaN,895.0,932.5,918.5,930.5,944.0,942.0,724.0,830.5,NaN,992.0,NaN,984.0,987.5,NaN,989.5,NaN,989.0,790.5,916.0],\n",
       "\"..upper..\":[NaN,NaN,991.5,NaN,NaN,NaN,NaN,966.0,NaN,NaN,975.0,NaN,NaN,993.0,NaN,993.5,NaN,NaN,NaN,714.5,NaN,NaN,909.0,981.0,966.5,974.0,983.0,979.5,765.5,911.0,NaN,1000.0,NaN,996.5,1001.0,NaN,1002.0,NaN,999.0,811.0,929.5],\n",
       "\"..ymin..\":[NaN,NaN,962.0,NaN,NaN,NaN,NaN,949.0,NaN,NaN,947.0,NaN,NaN,936.0,NaN,963.0,NaN,NaN,NaN,676.0,NaN,NaN,875.0,912.0,890.0,897.0,914.0,915.0,674.0,729.0,NaN,987.0,NaN,980.0,983.0,NaN,976.0,NaN,975.0,774.0,903.0],\n",
       "\"..ymax..\":[NaN,NaN,1004.0,NaN,NaN,NaN,NaN,973.0,NaN,NaN,977.0,NaN,NaN,1000.0,NaN,999.0,NaN,NaN,NaN,744.0,NaN,NaN,917.0,995.0,983.0,992.0,992.0,989.0,770.0,919.0,NaN,1004.0,NaN,1001.0,1004.0,NaN,1006.0,NaN,1002.0,812.0,934.0],\n",
       "\"term\":[\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"fall\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"spring\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\",\"summer\"],\n",
       "\"weekday\":[\"周一\",\"周一\",\"周一\",\"周二\",\"周二\",\"周二\",\"周二\",\"周二\",\"周三\",\"周三\",\"周三\",\"周四\",\"周四\",\"周四\",\"周五\",\"周五\",\"周六\",\"周六\",\"周六\",\"周六\",\"周日\",\"周日\",\"周日\",\"周一\",\"周二\",\"周三\",\"周四\",\"周五\",\"周六\",\"周日\",\"周一\",\"周一\",\"周二\",\"周二\",\"周三\",\"周四\",\"周四\",\"周五\",\"周五\",\"周六\",\"周日\"],\n",
       "\"y\":[929.0,942.0,NaN,989.0,943.0,761.0,776.0,NaN,1014.0,719.0,NaN,922.0,634.0,NaN,661.0,NaN,857.0,811.0,814.0,NaN,718.0,987.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,966.0,NaN,945.0,NaN,NaN,737.0,NaN,822.0,NaN,NaN,NaN]\n",
       "}\n",
       "},{\n",
       "\"geom\":\"point\",\n",
       "\"mapping\":{\n",
       "\"x\":\"weekday\",\n",
       "\"y\":\"pred\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"#FF00FF\",\n",
       "\"size\":3,\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"XnEbgS\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e1871ad90>"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily6) \\\n",
    "+ geom_boxplot(aes(x='weekday', y='y'), color='#4169E1', size=1) \\\n",
    "+ geom_point(aes(x='weekday', y='pred'), color='#FF00FF', size=3) \\\n",
    "+ facet_wrap(facets='term', nrow=1) \\\n",
    "+ ggsize(1000, 300)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "鲁棒回归模型中预测值距离均值更近了。自此分析完毕。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"qyhmgh\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"event_date\":[1.3575168E12,1.3581216E12,1.3587264E12,1.3593312E12,1.359936E12,1.3605408E12,1.3611456E12,1.3617504E12,1.3623552E12,1.36296E12,1.3635648E12,1.3641696E12,1.3647744E12,1.3653792E12,1.365984E12,1.3665888E12,1.3671936E12,1.3677984E12,1.3684032E12,1.369008E12,1.3696128E12,1.3702176E12,1.3708224E12,1.3714272E12,1.372032E12,1.3726368E12,1.3732416E12,1.3738464E12,1.3744512E12,1.375056E12,1.3756608E12,1.3762656E12,1.3768704E12,1.3774752E12,1.37808E12,1.3786848E12,1.3792896E12,1.3798944E12,1.3804992E12,1.381104E12,1.3817088E12,1.3823136E12,1.3829184E12,1.3835232E12,1.384128E12,1.3847328E12,1.3853376E12,1.3859424E12,1.3865472E12,1.387152E12,1.3877568E12,1.3883616E12,1.3569984E12,1.3576032E12,1.358208E12,1.3588128E12,1.3594176E12,1.3600224E12,1.3606272E12,1.361232E12,1.3618368E12,1.3624416E12,1.3630464E12,1.3636512E12,1.364256E12,1.3648608E12,1.3654656E12,1.3660704E12,1.3666752E12,1.36728E12,1.3678848E12,1.3684896E12,1.3690944E12,1.3696992E12,1.370304E12,1.3709088E12,1.3715136E12,1.3721184E12,1.3727232E12,1.373328E12,1.3739328E12,1.3745376E12,1.3751424E12,1.3757472E12,1.376352E12,1.3769568E12,1.3775616E12,1.3781664E12,1.3787712E12,1.379376E12,1.3799808E12,1.3805856E12,1.3811904E12,1.3817952E12,1.3824E12,1.3830048E12,1.3836096E12,1.3842144E12,1.3848192E12,1.385424E12,1.3860288E12,1.3866336E12,1.3872384E12,1.3878432E12,1.388448E12,1.3570848E12,1.3576896E12,1.3582944E12,1.3588992E12,1.359504E12,1.3601088E12,1.3607136E12,1.3613184E12,1.3619232E12,1.362528E12,1.3631328E12,1.3637376E12,1.3643424E12,1.3649472E12,1.365552E12,1.3661568E12,1.3667616E12,1.3673664E12,1.3679712E12,1.368576E12,1.3691808E12,1.3697856E12,1.3703904E12,1.3709952E12,1.3716E12,1.3722048E12,1.3728096E12,1.3734144E12,1.3740192E12,1.374624E12,1.3752288E12,1.3758336E12,1.3764384E12,1.3770432E12,1.377648E12,1.3782528E12,1.3788576E12,1.3794624E12,1.3800672E12,1.380672E12,1.3812768E12,1.3818816E12,1.3824864E12,1.3830912E12,1.383696E12,1.3843008E12,1.3849056E12,1.3855104E12,1.3861152E12,1.38672E12,1.3873248E12,1.3879296E12,1.3571712E12,1.357776E12,1.3583808E12,1.3589856E12,1.3595904E12,1.3601952E12,1.3608E12,1.3614048E12,1.3620096E12,1.3626144E12,1.3632192E12,1.363824E12,1.3644288E12,1.3650336E12,1.3656384E12,1.3662432E12,1.366848E12,1.3674528E12,1.3680576E12,1.3686624E12,1.3692672E12,1.369872E12,1.3704768E12,1.3710816E12,1.3716864E12,1.3722912E12,1.372896E12,1.3735008E12,1.3741056E12,1.3747104E12,1.3753152E12,1.37592E12,1.3765248E12,1.3771296E12,1.3777344E12,1.3783392E12,1.378944E12,1.3795488E12,1.3801536E12,1.3807584E12,1.3813632E12,1.381968E12,1.3825728E12,1.3831776E12,1.3837824E12,1.3843872E12,1.384992E12,1.3855968E12,1.3862016E12,1.3868064E12,1.3874112E12,1.388016E12,1.3572576E12,1.3578624E12,1.3584672E12,1.359072E12,1.3596768E12,1.3602816E12,1.3608864E12,1.3614912E12,1.362096E12,1.3627008E12,1.3633056E12,1.3639104E12,1.3645152E12,1.36512E12,1.3657248E12,1.3663296E12,1.3669344E12,1.3675392E12,1.368144E12,1.3687488E12,1.3693536E12,1.3699584E12,1.3705632E12,1.371168E12,1.3717728E12,1.3723776E12,1.3729824E12,1.3735872E12,1.374192E12,1.3747968E12,1.3754016E12,1.3760064E12,1.3766112E12,1.377216E12,1.3778208E12,1.3784256E12,1.3790304E12,1.3796352E12,1.38024E12,1.3808448E12,1.3814496E12,1.3820544E12,1.3826592E12,1.383264E12,1.3838688E12,1.3844736E12,1.3850784E12,1.3856832E12,1.386288E12,1.3868928E12,1.3874976E12,1.3881024E12,1.357344E12,1.3579488E12,1.3585536E12,1.3591584E12,1.3597632E12,1.360368E12,1.3609728E12,1.3615776E12,1.3621824E12,1.3627872E12,1.363392E12,1.3639968E12,1.3646016E12,1.3652064E12,1.3658112E12,1.366416E12,1.3670208E12,1.3676256E12,1.3682304E12,1.3688352E12,1.36944E12,1.3700448E12,1.3706496E12,1.3712544E12,1.3718592E12,1.372464E12,1.3730688E12,1.3736736E12,1.3742784E12,1.3748832E12,1.375488E12,1.3760928E12,1.3766976E12,1.3773024E12,1.3779072E12,1.378512E12,1.3791168E12,1.3797216E12,1.3803264E12,1.3809312E12,1.381536E12,1.3821408E12,1.3827456E12,1.3833504E12,1.3839552E12,1.38456E12,1.3851648E12,1.3857696E12,1.3863744E12,1.3869792E12,1.387584E12,1.3881888E12,1.3574304E12,1.3580352E12,1.35864E12,1.3592448E12,1.3598496E12,1.3604544E12,1.3610592E12,1.361664E12,1.3622688E12,1.3628736E12,1.3634784E12,1.3640832E12,1.364688E12,1.3652928E12,1.3658976E12,1.3665024E12,1.3671072E12,1.367712E12,1.3683168E12,1.3689216E12,1.3695264E12,1.3701312E12,1.370736E12,1.3713408E12,1.3719456E12,1.3725504E12,1.3731552E12,1.37376E12,1.3743648E12,1.3749696E12,1.3755744E12,1.3761792E12,1.376784E12,1.3773888E12,1.3779936E12,1.3785984E12,1.3792032E12,1.379808E12,1.3804128E12,1.3810176E12,1.3816224E12,1.3822272E12,1.382832E12,1.3834368E12,1.3840416E12,1.3846464E12,1.3852512E12,1.385856E12,1.3864608E12,1.3870656E12,1.3876704E12,1.3882752E12],\n",
       "\"y\":[933.0,928.0,912.0,923.0,932.0,929.0,948.0,961.0,977.0,980.0,981.0,978.0,970.0,981.0,995.0,985.0,983.0,980.0,979.0,983.0,928.0,982.0,987.0,990.0,994.0,966.0,1004.0,999.0,1000.0,999.0,1000.0,1001.0,996.0,982.0,929.0,991.0,992.0,993.0,993.0,994.0,987.0,991.0,983.0,978.0,983.0,985.0,942.0,1004.0,962.0,964.0,985.0,968.0,842.0,899.0,894.0,890.0,890.0,896.0,893.0,943.0,938.0,965.0,966.0,967.0,973.0,983.0,975.0,974.0,965.0,960.0,955.0,955.0,962.0,981.0,960.0,980.0,982.0,993.0,945.0,1001.0,996.0,997.0,997.0,996.0,995.0,986.0,965.0,956.0,961.0,961.0,960.0,965.0,964.0,963.0,964.0,965.0,967.0,973.0,973.0,989.0,973.0,943.0,949.0,761.0,776.0,943.0,902.0,901.0,897.0,900.0,901.0,918.0,949.0,945.0,972.0,974.0,970.0,977.0,992.0,989.0,988.0,976.0,964.0,965.0,967.0,972.0,974.0,970.0,983.0,985.0,995.0,983.0,1004.0,1001.0,1000.0,1001.0,1001.0,997.0,990.0,973.0,948.0,947.0,972.0,976.0,975.0,974.0,974.0,975.0,973.0,973.0,976.0,977.0,1014.0,958.0,954.0,956.0,719.0,914.0,932.0,927.0,925.0,928.0,932.0,956.0,961.0,964.0,980.0,982.0,980.0,982.0,985.0,992.0,992.0,983.0,983.0,981.0,982.0,988.0,989.0,976.0,989.0,995.0,995.0,737.0,1006.0,1003.0,1003.0,1000.0,1001.0,1000.0,990.0,979.0,969.0,992.0,992.0,996.0,995.0,994.0,995.0,992.0,922.0,991.0,988.0,1000.0,634.0,969.0,968.0,974.0,936.0,915.0,930.0,924.0,922.0,926.0,930.0,954.0,957.0,958.0,979.0,979.0,977.0,974.0,981.0,989.0,988.0,981.0,978.0,978.0,980.0,978.0,986.0,975.0,989.0,993.0,994.0,822.0,1002.0,999.0,999.0,999.0,999.0,998.0,989.0,965.0,967.0,996.0,994.0,996.0,995.0,991.0,993.0,989.0,986.0,986.0,985.0,999.0,661.0,970.0,970.0,980.0,963.0,720.0,690.0,674.0,680.0,682.0,684.0,738.0,743.0,765.0,765.0,767.0,767.0,769.0,770.0,770.0,766.0,757.0,745.0,738.0,749.0,728.0,754.0,779.0,801.0,812.0,812.0,805.0,811.0,810.0,811.0,809.0,807.0,780.0,774.0,680.0,688.0,686.0,693.0,682.0,687.0,676.0,684.0,685.0,689.0,715.0,714.0,744.0,857.0,691.0,692.0,811.0,814.0,832.0,828.0,786.0,823.0,814.0,829.0,848.0,880.0,913.0,908.0,907.0,905.0,897.0,911.0,917.0,919.0,913.0,912.0,896.0,911.0,729.0,911.0,908.0,918.0,923.0,918.0,934.0,931.0,929.0,930.0,929.0,929.0,914.0,903.0,718.0,908.0,900.0,904.0,914.0,917.0,902.0,915.0,910.0,902.0,895.0,896.0,896.0,987.0,875.0,880.0,895.0,888.0],\n",
       "\"pred\":[966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,966.3306604759779,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,994.677154468192,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,981.6790052547121,null,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,954.649012317423,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,989.9771544654611,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,961.1732215420012,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,960.5939017241894,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,994.5454545454554,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,967.5625000000009,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,971.2893291293143,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,994.0701404168318,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,981.6209756005161,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,967.3518291004214,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,992.0701404175178,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,982.4571496810546,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,746.9768292011214,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,801.2519586072682,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,696.7795586635068,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,893.7191035365968,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,922.1666666666672,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978,899.918102978978]\n",
       "},\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":900,\n",
       "\"height\":400\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"format\":\"%Y-%m-%d\",\n",
       "\"datetime\":true\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"blue\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"pred\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"magenta\",\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"qyhmgh\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e18757310>"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily6) \\\n",
    "+ geom_line(aes(x='event_date', y='y'), color='blue') \\\n",
    "+ geom_line(aes(x='event_date', y='pred'), color='magenta') \\\n",
    "+ scale_x_datetime(format='%Y-%m-%d') \\\n",
    "+ ggsize(900, 400)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "当然从图中可以看到，第1季度的预测值明显偏高，这是因为没有考虑总体趋势，如果增加1个时间变量，就有总体趋势了。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 总体趋势"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                    Robust linear Model Regression Results                    \n",
      "==============================================================================\n",
      "Dep. Variable:                      y   No. Observations:                  364\n",
      "Model:                            RLM   Df Residuals:                      342\n",
      "Method:                          IRLS   Df Model:                           21\n",
      "Norm:                          HuberT                                         \n",
      "Scale Est.:                       mad                                         \n",
      "Cov Type:                          H1                                         \n",
      "Date:                Tue, 09 Nov 2021                                         \n",
      "Time:                        15:38:49                                         \n",
      "No. Iterations:                    50                                         \n",
      "================================================================================================\n",
      "                                   coef    std err          z      P>|z|      [0.025      0.975]\n",
      "------------------------------------------------------------------------------------------------\n",
      "Intercept                      939.1897      5.124    183.308      0.000     929.148     949.232\n",
      "weekday[T.周二]                  -15.4297      6.431     -2.399      0.016     -28.033      -2.826\n",
      "weekday[T.周三]                   -7.6660      6.360     -1.205      0.228     -20.132       4.800\n",
      "weekday[T.周四]                    3.7657      6.432      0.586      0.558      -8.840      16.371\n",
      "weekday[T.周五]                   -0.1097      6.431     -0.017      0.986     -12.714      12.495\n",
      "weekday[T.周六]                 -220.5767      6.431    -34.300      0.000    -233.181    -207.973\n",
      "weekday[T.周日]                  -76.6948      6.431    -11.927      0.000     -89.298     -64.091\n",
      "term[T.summer]                  -3.0162      8.573     -0.352      0.725     -19.820      13.787\n",
      "term[T.fall]                   -45.8569      9.298     -4.932      0.000     -64.080     -27.634\n",
      "weekday[T.周二]:term[T.summer]    10.3485     11.138      0.929      0.353     -11.481      32.178\n",
      "weekday[T.周三]:term[T.summer]     7.4377     11.098      0.670      0.503     -14.314      29.189\n",
      "weekday[T.周四]:term[T.summer]    -4.1630     10.983     -0.379      0.705     -25.689      17.363\n",
      "weekday[T.周五]:term[T.summer]    -2.5836     10.983     -0.235      0.814     -24.109      18.942\n",
      "weekday[T.周六]:term[T.summer]    28.7445     10.983      2.617      0.009       7.219      50.270\n",
      "weekday[T.周日]:term[T.summer]     4.4552     10.983      0.406      0.685     -17.070      25.981\n",
      "weekday[T.周二]:term[T.fall]      -3.1773      9.446     -0.336      0.737     -21.692      15.337\n",
      "weekday[T.周三]:term[T.fall]      -4.5102      9.469     -0.476      0.634     -23.069      14.049\n",
      "weekday[T.周四]:term[T.fall]      -2.5328      9.517     -0.266      0.790     -21.186      16.120\n",
      "weekday[T.周五]:term[T.fall]       1.3643      9.517      0.143      0.886     -17.288      20.017\n",
      "weekday[T.周六]:term[T.fall]     -61.4783      9.517     -6.460      0.000     -80.131     -42.825\n",
      "weekday[T.周日]:term[T.fall]      -5.4228      9.517     -0.570      0.569     -24.076      13.230\n",
      "dayofyear                        0.2960      0.029     10.090      0.000       0.238       0.353\n",
      "================================================================================================\n",
      "\n",
      "If the model instance has been used for another fit with different fit parameters, then the fit options might not be the correct ones anymore .\n"
     ]
    }
   ],
   "source": [
    "df_daily7 = df_daily4.eval('dayofyear = event_date.dt.dayofyear', engine='python')\n",
    "mod4 = smf.rlm('y ~ weekday * term + dayofyear', data=df_daily7).fit()\n",
    "print(mod4.summary())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x</th>\n",
       "      <th>event_date</th>\n",
       "      <th>y</th>\n",
       "      <th>weekday</th>\n",
       "      <th>term</th>\n",
       "      <th>dayofyear</th>\n",
       "      <th>pred</th>\n",
       "      <th>resid</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-07</td>\n",
       "      <td>933</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>7</td>\n",
       "      <td>941.261405</td>\n",
       "      <td>-8.261405</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-14</td>\n",
       "      <td>928</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>14</td>\n",
       "      <td>943.333131</td>\n",
       "      <td>-15.333131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-21</td>\n",
       "      <td>912</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>21</td>\n",
       "      <td>945.404857</td>\n",
       "      <td>-33.404857</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-01-28</td>\n",
       "      <td>923</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>28</td>\n",
       "      <td>947.476583</td>\n",
       "      <td>-24.476583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2013-02-04</td>\n",
       "      <td>932</td>\n",
       "      <td>周一</td>\n",
       "      <td>spring</td>\n",
       "      <td>35</td>\n",
       "      <td>949.548309</td>\n",
       "      <td>-17.548309</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   x event_date    y weekday    term  dayofyear        pred      resid\n",
       "0  0 2013-01-07  933      周一  spring          7  941.261405  -8.261405\n",
       "1  0 2013-01-14  928      周一  spring         14  943.333131 -15.333131\n",
       "2  0 2013-01-21  912      周一  spring         21  945.404857 -33.404857\n",
       "3  0 2013-01-28  923      周一  spring         28  947.476583 -24.476583\n",
       "4  0 2013-02-04  932      周一  spring         35  949.548309 -17.548309"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_daily7['pred'] = mod4.predict(exog=df_daily7[['weekday', 'term', 'dayofyear']]) # 预测值\n",
    "df_daily7['pred'] = mod4.fittedvalues # 预测值\n",
    "df_daily7['resid'] = df_daily7['y']  - df_daily7['pred'] # 残差\n",
    "df_daily7.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"PMUmQa\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"event_date\":[1.3575168E12,1.3581216E12,1.3587264E12,1.3593312E12,1.359936E12,1.3605408E12,1.3611456E12,1.3617504E12,1.3623552E12,1.36296E12,1.3635648E12,1.3641696E12,1.3647744E12,1.3653792E12,1.365984E12,1.3665888E12,1.3671936E12,1.3677984E12,1.3684032E12,1.369008E12,1.3696128E12,1.3702176E12,1.3708224E12,1.3714272E12,1.372032E12,1.3726368E12,1.3732416E12,1.3738464E12,1.3744512E12,1.375056E12,1.3756608E12,1.3762656E12,1.3768704E12,1.3774752E12,1.37808E12,1.3786848E12,1.3792896E12,1.3798944E12,1.3804992E12,1.381104E12,1.3817088E12,1.3823136E12,1.3829184E12,1.3835232E12,1.384128E12,1.3847328E12,1.3853376E12,1.3859424E12,1.3865472E12,1.387152E12,1.3877568E12,1.3883616E12,1.3569984E12,1.3576032E12,1.358208E12,1.3588128E12,1.3594176E12,1.3600224E12,1.3606272E12,1.361232E12,1.3618368E12,1.3624416E12,1.3630464E12,1.3636512E12,1.364256E12,1.3648608E12,1.3654656E12,1.3660704E12,1.3666752E12,1.36728E12,1.3678848E12,1.3684896E12,1.3690944E12,1.3696992E12,1.370304E12,1.3709088E12,1.3715136E12,1.3721184E12,1.3727232E12,1.373328E12,1.3739328E12,1.3745376E12,1.3751424E12,1.3757472E12,1.376352E12,1.3769568E12,1.3775616E12,1.3781664E12,1.3787712E12,1.379376E12,1.3799808E12,1.3805856E12,1.3811904E12,1.3817952E12,1.3824E12,1.3830048E12,1.3836096E12,1.3842144E12,1.3848192E12,1.385424E12,1.3860288E12,1.3866336E12,1.3872384E12,1.3878432E12,1.388448E12,1.3570848E12,1.3576896E12,1.3582944E12,1.3588992E12,1.359504E12,1.3601088E12,1.3607136E12,1.3613184E12,1.3619232E12,1.362528E12,1.3631328E12,1.3637376E12,1.3643424E12,1.3649472E12,1.365552E12,1.3661568E12,1.3667616E12,1.3673664E12,1.3679712E12,1.368576E12,1.3691808E12,1.3697856E12,1.3703904E12,1.3709952E12,1.3716E12,1.3722048E12,1.3728096E12,1.3734144E12,1.3740192E12,1.374624E12,1.3752288E12,1.3758336E12,1.3764384E12,1.3770432E12,1.377648E12,1.3782528E12,1.3788576E12,1.3794624E12,1.3800672E12,1.380672E12,1.3812768E12,1.3818816E12,1.3824864E12,1.3830912E12,1.383696E12,1.3843008E12,1.3849056E12,1.3855104E12,1.3861152E12,1.38672E12,1.3873248E12,1.3879296E12,1.3571712E12,1.357776E12,1.3583808E12,1.3589856E12,1.3595904E12,1.3601952E12,1.3608E12,1.3614048E12,1.3620096E12,1.3626144E12,1.3632192E12,1.363824E12,1.3644288E12,1.3650336E12,1.3656384E12,1.3662432E12,1.366848E12,1.3674528E12,1.3680576E12,1.3686624E12,1.3692672E12,1.369872E12,1.3704768E12,1.3710816E12,1.3716864E12,1.3722912E12,1.372896E12,1.3735008E12,1.3741056E12,1.3747104E12,1.3753152E12,1.37592E12,1.3765248E12,1.3771296E12,1.3777344E12,1.3783392E12,1.378944E12,1.3795488E12,1.3801536E12,1.3807584E12,1.3813632E12,1.381968E12,1.3825728E12,1.3831776E12,1.3837824E12,1.3843872E12,1.384992E12,1.3855968E12,1.3862016E12,1.3868064E12,1.3874112E12,1.388016E12,1.3572576E12,1.3578624E12,1.3584672E12,1.359072E12,1.3596768E12,1.3602816E12,1.3608864E12,1.3614912E12,1.362096E12,1.3627008E12,1.3633056E12,1.3639104E12,1.3645152E12,1.36512E12,1.3657248E12,1.3663296E12,1.3669344E12,1.3675392E12,1.368144E12,1.3687488E12,1.3693536E12,1.3699584E12,1.3705632E12,1.371168E12,1.3717728E12,1.3723776E12,1.3729824E12,1.3735872E12,1.374192E12,1.3747968E12,1.3754016E12,1.3760064E12,1.3766112E12,1.377216E12,1.3778208E12,1.3784256E12,1.3790304E12,1.3796352E12,1.38024E12,1.3808448E12,1.3814496E12,1.3820544E12,1.3826592E12,1.383264E12,1.3838688E12,1.3844736E12,1.3850784E12,1.3856832E12,1.386288E12,1.3868928E12,1.3874976E12,1.3881024E12,1.357344E12,1.3579488E12,1.3585536E12,1.3591584E12,1.3597632E12,1.360368E12,1.3609728E12,1.3615776E12,1.3621824E12,1.3627872E12,1.363392E12,1.3639968E12,1.3646016E12,1.3652064E12,1.3658112E12,1.366416E12,1.3670208E12,1.3676256E12,1.3682304E12,1.3688352E12,1.36944E12,1.3700448E12,1.3706496E12,1.3712544E12,1.3718592E12,1.372464E12,1.3730688E12,1.3736736E12,1.3742784E12,1.3748832E12,1.375488E12,1.3760928E12,1.3766976E12,1.3773024E12,1.3779072E12,1.378512E12,1.3791168E12,1.3797216E12,1.3803264E12,1.3809312E12,1.381536E12,1.3821408E12,1.3827456E12,1.3833504E12,1.3839552E12,1.38456E12,1.3851648E12,1.3857696E12,1.3863744E12,1.3869792E12,1.387584E12,1.3881888E12,1.3574304E12,1.3580352E12,1.35864E12,1.3592448E12,1.3598496E12,1.3604544E12,1.3610592E12,1.361664E12,1.3622688E12,1.3628736E12,1.3634784E12,1.3640832E12,1.364688E12,1.3652928E12,1.3658976E12,1.3665024E12,1.3671072E12,1.367712E12,1.3683168E12,1.3689216E12,1.3695264E12,1.3701312E12,1.370736E12,1.3713408E12,1.3719456E12,1.3725504E12,1.3731552E12,1.37376E12,1.3743648E12,1.3749696E12,1.3755744E12,1.3761792E12,1.376784E12,1.3773888E12,1.3779936E12,1.3785984E12,1.3792032E12,1.379808E12,1.3804128E12,1.3810176E12,1.3816224E12,1.3822272E12,1.382832E12,1.3834368E12,1.3840416E12,1.3846464E12,1.3852512E12,1.385856E12,1.3864608E12,1.3870656E12,1.3876704E12,1.3882752E12],\n",
       "\"resid\":[-8.261405148247604,-15.333131229420019,-33.40485731059232,-24.476583391764734,-17.54830947293715,-22.620035554109563,-5.691761635281864,5.236512283545721,19.164786202373307,20.093060121200892,19.02133404002859,13.949607958856177,3.8778818776837625,12.806155796511348,24.734429715338933,12.662703634166633,8.590977552994218,3.5192514718218035,0.447525390649389,2.375799309477088,-54.695926771695326,-2.767652852867741,3.1768122240454204,4.105086142873006,6.033360061700705,-24.03836601947171,11.889907899355876,4.8181818181834615,3.7464557370111606,0.6747296558387461,-0.3969964253336684,-1.468722506506083,-8.540448587678384,18.228520161416327,-36.84320591975609,23.085067999071498,22.013341917899197,20.941615836726783,18.869889755554368,17.798163674381954,8.726437593209539,10.654711512037238,0.5829854308648237,-6.488740650307591,-3.5604667314800054,-3.63219281265242,-48.70391889382472,11.224355025002865,-32.84737105616955,-32.91909713734185,-13.990823218514265,-33.06254929968668,null,-27.1276675223653,-34.199393603537715,-40.271119684710015,-42.34284576588243,-38.414571847054845,-43.48629792822726,4.44197599060044,-2.6297500905719744,22.29852382825561,21.226797747083197,20.155071665910896,24.08334558473848,32.01161950356607,21.939893422393652,18.868167341221238,7.796441260048937,0.7247151788765223,-6.347010902295892,-8.418736983468307,-3.4904630646406076,13.437810854186978,-9.633915226985437,0.9620329261672396,0.8903068449949387,9.818580763822524,-40.25314531734989,13.675128601477695,6.603402520305281,5.53167643913298,3.4599503579605653,0.38822427678815075,-2.683501804384264,-13.755227885556565,19.53956870491004,8.467842623737624,11.39611654256521,9.324390461392795,6.252664380220494,9.18093829904808,6.109212217875665,3.037486136703251,1.96576005553095,0.8940339743585355,0.822307893186121,4.750581812013706,2.6788557308414056,16.60712964966899,-1.4645964315034234,-33.53632251267584,-29.608048593848252,-219.67977467502055,-206.75150075619297,10.884409347344672,-32.18731673382774,-35.25904281500004,-41.33076889617246,-40.40249497734487,-41.47422105851729,-26.5459471396897,2.3823267791379976,-3.689399302034417,21.23887461679317,21.167148535620754,15.095422454448453,20.02369637327604,32.951970292103624,27.88024421093121,24.808518129758795,10.736792048586494,-3.3349340325859202,-4.406660113758335,-4.478386194930749,-1.5501122761030501,-1.6218383572754647,-7.693564438447879,-1.1868241395901578,-1.2585502207624586,6.669723698065127,-7.402002383107288,11.526271535720298,6.454545454547997,3.3828193733755825,2.311093292203168,0.23936721103075342,-5.832358870141661,-14.904084951313962,20.81285324340911,-6.258872837763306,-9.33059891893572,13.597674999891979,15.525948918719564,12.45422283754715,9.382496756374735,7.3107706752023205,6.23904459403002,2.167318512857605,0.0955924316851906,1.023866350512776,-0.04785973065952476,34.88041418816806,-23.191311893004354,-29.26303797417677,-29.33476405534907,-268.4064901365215,-29.84326535966693,-13.914991440839344,-20.986717522011645,-25.05844360318406,-24.130169684356474,-22.20189576552889,-0.2736218467013032,2.654652072126396,3.5829259909539815,17.511199909781567,17.439473828609152,13.367747747436852,13.296021666264437,14.224295585092023,19.152569503919608,17.080843422747307,6.009117341574893,3.937391260402478,-0.1343348207699364,-1.206060901942351,2.7222130168853482,1.6504869357129337,-6.242037270208016,4.68623664861957,8.614510567447269,6.542784486274854,-253.52894159489756,13.399332323930025,8.32760624275761,6.25588016158531,1.1841540804128954,0.11242799924048086,-2.9592980819319337,-15.031024163104235,13.107711524353249,1.0359854431808344,21.96425936200842,19.89253328083612,21.820807199663705,18.74908111849129,15.677355037318875,14.605628956146575,9.53390287497416,-62.537823206198254,4.390450712629331,-0.6812753685430835,9.246998550284616,-358.8247275308878,-25.896453612060213,-28.968179693232628,-25.039905774405042,-65.11163185557734,-25.26384295740195,-12.335569038574363,-20.407295119746664,-24.479021200919078,-22.550747282091493,-20.622473363263907,1.305800555563792,2.2340744743913774,1.1623483932189629,20.09062231204655,18.018896230874134,13.947170149701833,8.875444068529418,13.803717987357004,19.73199190618459,16.66026582501229,7.588539743839874,2.5168136626674595,0.445087581495045,0.3733615003227442,-3.6983645808496703,2.229909337977915,-5.242037269870593,6.686236648956992,8.614510567784691,7.542784486612277,-166.52894159456014,11.399332324267448,6.327606243095147,4.255880161922732,2.184154080750318,0.11242799957790339,-2.9592980815943974,-14.031024162766812,-1.209960095763563,-1.2816861769359775,25.646587741891608,21.574861660719307,21.503135579546893,18.431409498374478,12.359683417202064,12.287957336029649,6.216231254857348,1.1445051736849337,-0.9272209074874809,-3.9989469886598954,7.929326930167804,-332.1423991510046,-25.214125232177025,-27.28585131334944,-19.35757739452174,-38.429303475694155,-0.09281321622199812,-32.16453929739441,-50.23626537856671,-46.30799145973913,-46.37971754091154,-46.45144362208396,5.476830296743742,8.405104215571328,28.333378134398913,26.2616520532265,26.189925972054084,24.118199890881783,24.04647380970937,22.974747728536954,20.90302164736454,14.831295566192239,3.7595694850198242,-10.31215659615259,-19.383882677325005,-10.45560875849742,-33.52733483966972,-9.599060920842135,-12.399118030310092,7.529155888517494,16.457429807345193,14.385703726172778,5.313977645000364,9.24225156382795,6.170525482655648,5.098799401483234,1.0270733203108193,-3.044652760861595,-32.11637884203401,-40.18810492320631,-3.1963081853442645,2.731965733483321,-1.3397603476890936,3.5885135711386056,-9.483212510033809,-6.5549385912062235,-19.626664672378638,-13.698390753550939,-14.770116834723353,-12.841842915895768,11.086431002931818,8.014704921759403,35.9429788405871,146.8712527594147,-21.200473321757727,-22.27219940293014,94.65607451589756,95.58434843472514,-32.270662264515636,-38.34238834568805,-82.41411442686035,-47.485840508032766,-58.55756658920518,-45.629292670377595,-28.701018751549896,1.22725516727769,32.155529086105275,25.08380300493286,22.01207692376056,17.940350842588145,7.868624761415731,19.796898680243316,23.725172599070902,23.6534465178986,15.581720436726187,12.509994355553772,-5.5617317256186425,7.366542193209057,-176.70518388796336,3.2230900308642276,-3.287681141968278,4.640592776859307,7.5688666956870065,0.497140614514592,14.425414533342177,9.353688452169763,5.281962370997462,4.210236289825048,1.138510208652633,-0.9332158725197814,-18.004941953692196,-31.076668034864497,-165.4296945582771,22.49857936055048,12.426853279378065,14.35512719820565,22.28340111703335,23.211675035860935,6.139948954688521,17.068222873516106,9.996496792343805,-0.07522928882860924,-9.146955370001024,-10.218681451173438,-12.290407532345853,76.63786638648185,-37.43385969469057,-34.50558577586298,-21.577311857035397,-30.649037938207698]\n",
       "},\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"resid\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":900,\n",
       "\"height\":400\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"format\":\"%Y-%m-%d\",\n",
       "\"datetime\":true\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"geom\":\"hline\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"yintercept\":0,\n",
       "\"size\":3,\n",
       "\"color\":\"yellow\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"gray\",\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"PMUmQa\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e187fd5b0>"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily7, aes(x='event_date', y='resid')) \\\n",
    "+ geom_hline(yintercept=0, size=3, color='yellow') \\\n",
    "+ geom_line(color='gray') \\\n",
    "+ scale_x_datetime(format='%Y-%m-%d') \\\n",
    "+ ggsize(900, 400)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"Nk9VyV\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"data\":{\n",
       "\"event_date\":[1.3575168E12,1.3581216E12,1.3587264E12,1.3593312E12,1.359936E12,1.3605408E12,1.3611456E12,1.3617504E12,1.3623552E12,1.36296E12,1.3635648E12,1.3641696E12,1.3647744E12,1.3653792E12,1.365984E12,1.3665888E12,1.3671936E12,1.3677984E12,1.3684032E12,1.369008E12,1.3696128E12,1.3702176E12,1.3708224E12,1.3714272E12,1.372032E12,1.3726368E12,1.3732416E12,1.3738464E12,1.3744512E12,1.375056E12,1.3756608E12,1.3762656E12,1.3768704E12,1.3774752E12,1.37808E12,1.3786848E12,1.3792896E12,1.3798944E12,1.3804992E12,1.381104E12,1.3817088E12,1.3823136E12,1.3829184E12,1.3835232E12,1.384128E12,1.3847328E12,1.3853376E12,1.3859424E12,1.3865472E12,1.387152E12,1.3877568E12,1.3883616E12,1.3569984E12,1.3576032E12,1.358208E12,1.3588128E12,1.3594176E12,1.3600224E12,1.3606272E12,1.361232E12,1.3618368E12,1.3624416E12,1.3630464E12,1.3636512E12,1.364256E12,1.3648608E12,1.3654656E12,1.3660704E12,1.3666752E12,1.36728E12,1.3678848E12,1.3684896E12,1.3690944E12,1.3696992E12,1.370304E12,1.3709088E12,1.3715136E12,1.3721184E12,1.3727232E12,1.373328E12,1.3739328E12,1.3745376E12,1.3751424E12,1.3757472E12,1.376352E12,1.3769568E12,1.3775616E12,1.3781664E12,1.3787712E12,1.379376E12,1.3799808E12,1.3805856E12,1.3811904E12,1.3817952E12,1.3824E12,1.3830048E12,1.3836096E12,1.3842144E12,1.3848192E12,1.385424E12,1.3860288E12,1.3866336E12,1.3872384E12,1.3878432E12,1.388448E12,1.3570848E12,1.3576896E12,1.3582944E12,1.3588992E12,1.359504E12,1.3601088E12,1.3607136E12,1.3613184E12,1.3619232E12,1.362528E12,1.3631328E12,1.3637376E12,1.3643424E12,1.3649472E12,1.365552E12,1.3661568E12,1.3667616E12,1.3673664E12,1.3679712E12,1.368576E12,1.3691808E12,1.3697856E12,1.3703904E12,1.3709952E12,1.3716E12,1.3722048E12,1.3728096E12,1.3734144E12,1.3740192E12,1.374624E12,1.3752288E12,1.3758336E12,1.3764384E12,1.3770432E12,1.377648E12,1.3782528E12,1.3788576E12,1.3794624E12,1.3800672E12,1.380672E12,1.3812768E12,1.3818816E12,1.3824864E12,1.3830912E12,1.383696E12,1.3843008E12,1.3849056E12,1.3855104E12,1.3861152E12,1.38672E12,1.3873248E12,1.3879296E12,1.3571712E12,1.357776E12,1.3583808E12,1.3589856E12,1.3595904E12,1.3601952E12,1.3608E12,1.3614048E12,1.3620096E12,1.3626144E12,1.3632192E12,1.363824E12,1.3644288E12,1.3650336E12,1.3656384E12,1.3662432E12,1.366848E12,1.3674528E12,1.3680576E12,1.3686624E12,1.3692672E12,1.369872E12,1.3704768E12,1.3710816E12,1.3716864E12,1.3722912E12,1.372896E12,1.3735008E12,1.3741056E12,1.3747104E12,1.3753152E12,1.37592E12,1.3765248E12,1.3771296E12,1.3777344E12,1.3783392E12,1.378944E12,1.3795488E12,1.3801536E12,1.3807584E12,1.3813632E12,1.381968E12,1.3825728E12,1.3831776E12,1.3837824E12,1.3843872E12,1.384992E12,1.3855968E12,1.3862016E12,1.3868064E12,1.3874112E12,1.388016E12,1.3572576E12,1.3578624E12,1.3584672E12,1.359072E12,1.3596768E12,1.3602816E12,1.3608864E12,1.3614912E12,1.362096E12,1.3627008E12,1.3633056E12,1.3639104E12,1.3645152E12,1.36512E12,1.3657248E12,1.3663296E12,1.3669344E12,1.3675392E12,1.368144E12,1.3687488E12,1.3693536E12,1.3699584E12,1.3705632E12,1.371168E12,1.3717728E12,1.3723776E12,1.3729824E12,1.3735872E12,1.374192E12,1.3747968E12,1.3754016E12,1.3760064E12,1.3766112E12,1.377216E12,1.3778208E12,1.3784256E12,1.3790304E12,1.3796352E12,1.38024E12,1.3808448E12,1.3814496E12,1.3820544E12,1.3826592E12,1.383264E12,1.3838688E12,1.3844736E12,1.3850784E12,1.3856832E12,1.386288E12,1.3868928E12,1.3874976E12,1.3881024E12,1.357344E12,1.3579488E12,1.3585536E12,1.3591584E12,1.3597632E12,1.360368E12,1.3609728E12,1.3615776E12,1.3621824E12,1.3627872E12,1.363392E12,1.3639968E12,1.3646016E12,1.3652064E12,1.3658112E12,1.366416E12,1.3670208E12,1.3676256E12,1.3682304E12,1.3688352E12,1.36944E12,1.3700448E12,1.3706496E12,1.3712544E12,1.3718592E12,1.372464E12,1.3730688E12,1.3736736E12,1.3742784E12,1.3748832E12,1.375488E12,1.3760928E12,1.3766976E12,1.3773024E12,1.3779072E12,1.378512E12,1.3791168E12,1.3797216E12,1.3803264E12,1.3809312E12,1.381536E12,1.3821408E12,1.3827456E12,1.3833504E12,1.3839552E12,1.38456E12,1.3851648E12,1.3857696E12,1.3863744E12,1.3869792E12,1.387584E12,1.3881888E12,1.3574304E12,1.3580352E12,1.35864E12,1.3592448E12,1.3598496E12,1.3604544E12,1.3610592E12,1.361664E12,1.3622688E12,1.3628736E12,1.3634784E12,1.3640832E12,1.364688E12,1.3652928E12,1.3658976E12,1.3665024E12,1.3671072E12,1.367712E12,1.3683168E12,1.3689216E12,1.3695264E12,1.3701312E12,1.370736E12,1.3713408E12,1.3719456E12,1.3725504E12,1.3731552E12,1.37376E12,1.3743648E12,1.3749696E12,1.3755744E12,1.3761792E12,1.376784E12,1.3773888E12,1.3779936E12,1.3785984E12,1.3792032E12,1.379808E12,1.3804128E12,1.3810176E12,1.3816224E12,1.3822272E12,1.382832E12,1.3834368E12,1.3840416E12,1.3846464E12,1.3852512E12,1.385856E12,1.3864608E12,1.3870656E12,1.3876704E12,1.3882752E12],\n",
       "\"y\":[933.0,928.0,912.0,923.0,932.0,929.0,948.0,961.0,977.0,980.0,981.0,978.0,970.0,981.0,995.0,985.0,983.0,980.0,979.0,983.0,928.0,982.0,987.0,990.0,994.0,966.0,1004.0,999.0,1000.0,999.0,1000.0,1001.0,996.0,982.0,929.0,991.0,992.0,993.0,993.0,994.0,987.0,991.0,983.0,978.0,983.0,985.0,942.0,1004.0,962.0,964.0,985.0,968.0,842.0,899.0,894.0,890.0,890.0,896.0,893.0,943.0,938.0,965.0,966.0,967.0,973.0,983.0,975.0,974.0,965.0,960.0,955.0,955.0,962.0,981.0,960.0,980.0,982.0,993.0,945.0,1001.0,996.0,997.0,997.0,996.0,995.0,986.0,965.0,956.0,961.0,961.0,960.0,965.0,964.0,963.0,964.0,965.0,967.0,973.0,973.0,989.0,973.0,943.0,949.0,761.0,776.0,943.0,902.0,901.0,897.0,900.0,901.0,918.0,949.0,945.0,972.0,974.0,970.0,977.0,992.0,989.0,988.0,976.0,964.0,965.0,967.0,972.0,974.0,970.0,983.0,985.0,995.0,983.0,1004.0,1001.0,1000.0,1001.0,1001.0,997.0,990.0,973.0,948.0,947.0,972.0,976.0,975.0,974.0,974.0,975.0,973.0,973.0,976.0,977.0,1014.0,958.0,954.0,956.0,719.0,914.0,932.0,927.0,925.0,928.0,932.0,956.0,961.0,964.0,980.0,982.0,980.0,982.0,985.0,992.0,992.0,983.0,983.0,981.0,982.0,988.0,989.0,976.0,989.0,995.0,995.0,737.0,1006.0,1003.0,1003.0,1000.0,1001.0,1000.0,990.0,979.0,969.0,992.0,992.0,996.0,995.0,994.0,995.0,992.0,922.0,991.0,988.0,1000.0,634.0,969.0,968.0,974.0,936.0,915.0,930.0,924.0,922.0,926.0,930.0,954.0,957.0,958.0,979.0,979.0,977.0,974.0,981.0,989.0,988.0,981.0,978.0,978.0,980.0,978.0,986.0,975.0,989.0,993.0,994.0,822.0,1002.0,999.0,999.0,999.0,999.0,998.0,989.0,965.0,967.0,996.0,994.0,996.0,995.0,991.0,993.0,989.0,986.0,986.0,985.0,999.0,661.0,970.0,970.0,980.0,963.0,720.0,690.0,674.0,680.0,682.0,684.0,738.0,743.0,765.0,765.0,767.0,767.0,769.0,770.0,770.0,766.0,757.0,745.0,738.0,749.0,728.0,754.0,779.0,801.0,812.0,812.0,805.0,811.0,810.0,811.0,809.0,807.0,780.0,774.0,680.0,688.0,686.0,693.0,682.0,687.0,676.0,684.0,685.0,689.0,715.0,714.0,744.0,857.0,691.0,692.0,811.0,814.0,832.0,828.0,786.0,823.0,814.0,829.0,848.0,880.0,913.0,908.0,907.0,905.0,897.0,911.0,917.0,919.0,913.0,912.0,896.0,911.0,729.0,911.0,908.0,918.0,923.0,918.0,934.0,931.0,929.0,930.0,929.0,929.0,914.0,903.0,718.0,908.0,900.0,904.0,914.0,917.0,902.0,915.0,910.0,902.0,895.0,896.0,896.0,987.0,875.0,880.0,895.0,888.0],\n",
       "\"pred\":[941.2614051482476,943.33313122942,945.4048573105923,947.4765833917647,949.5483094729371,951.6200355541096,953.6917616352819,955.7634877164543,957.8352137976267,959.9069398787991,961.9786659599714,964.0503920411438,966.1221181223162,968.1938442034887,970.2655702846611,972.3372963658334,974.4090224470058,976.4807485281782,978.5524746093506,980.6242006905229,982.6959267716953,984.7676528528677,983.8231877759546,985.894913857127,987.9666399382993,990.0383660194717,992.1100921006441,994.1818181818165,996.2535442629888,998.3252703441613,1000.3969964253337,1002.4687225065061,1004.5404485876784,963.7714798385837,965.8432059197561,967.9149320009285,969.9866580821008,972.0583841632732,974.1301102444456,976.201836325618,978.2735624067905,980.3452884879628,982.4170145691352,984.4887406503076,986.56046673148,988.6321928126524,990.7039188938247,992.7756449749971,994.8473710561695,996.9190971373419,998.9908232185143,1001.0625492996867,null,926.1276675223653,928.1993936035377,930.27111968471,932.3428457658824,934.4145718470548,936.4862979282273,938.5580240093996,940.629750090572,942.7014761717444,944.7732022529168,946.8449283340891,948.9166544152615,950.9883804964339,953.0601065776063,955.1318326587788,957.2035587399511,959.2752848211235,961.3470109022959,963.4187369834683,965.4904630646406,967.562189145813,969.6339152269854,979.0379670738328,981.1096931550051,983.1814192361775,985.2531453173499,987.3248713985223,989.3965974796947,991.468323560867,993.5400496420394,995.6117757232118,997.6835018043843,999.7552278855566,945.46043129509,947.5321573762624,949.6038834574348,951.6756095386072,953.7473356197795,955.8190617009519,957.8907877821243,959.9625138632967,962.034239944469,964.1059660256415,966.1776921068139,968.2494181879863,970.3211442691586,972.392870350331,974.4645964315034,976.5363225126758,978.6080485938483,980.6797746750206,982.751500756193,932.1155906526553,934.1873167338277,936.259042815,938.3307688961725,940.4024949773449,942.4742210585173,944.5459471396897,946.617673220862,948.6893993020344,950.7611253832068,952.8328514643792,954.9045775455515,956.976303626724,959.0480297078964,961.1197557890688,963.1914818702412,965.2632079514135,967.3349340325859,969.4066601137583,971.4783861949307,973.550112276103,975.6218383572755,977.6935644384479,984.1868241395902,986.2585502207625,988.3302763019349,990.4020023831073,992.4737284642797,994.545454545452,996.6171806266244,998.6889067077968,1000.7606327889692,1002.8323588701417,1004.904084951314,952.1871467565909,954.2588728377633,956.3305989189357,958.402325000108,960.4740510812804,962.5457771624529,964.6175032436253,966.6892293247977,968.76095540597,970.8326814871424,972.9044075683148,974.9761336494872,977.0478597306595,979.1195858118319,981.1913118930044,983.2630379741768,985.3347640553491,987.4064901365215,943.8432653596669,945.9149914408393,947.9867175220116,950.0584436031841,952.1301696843565,954.2018957655289,956.2736218467013,958.3453479278736,960.417074009046,962.4888000902184,964.5605261713908,966.6322522525631,968.7039783337356,970.775704414908,972.8474304960804,974.9191565772527,976.9908826584251,979.0626087395975,981.1343348207699,983.2060609019424,985.2777869831147,987.3495130642871,982.242037270208,984.3137633513804,986.3854894325527,988.4572155137251,990.5289415948976,992.60066767607,994.6723937572424,996.7441198384147,998.8158459195871,1000.8875720007595,1002.9592980819319,1005.0310241631042,965.8922884756468,967.9640145568192,970.0357406379916,972.1074667191639,974.1791928003363,976.2509188815087,978.3226449626811,980.3943710438534,982.4660971250258,984.5378232061983,986.6095492873707,988.6812753685431,990.7530014497154,992.8247275308878,994.8964536120602,996.9681796932326,999.039905774405,1001.1116318555773,940.263842957402,942.3355690385744,944.4072951197467,946.4790212009191,948.5507472820915,950.6224733632639,952.6941994444362,954.7659255256086,956.837651606781,958.9093776879535,960.9811037691259,963.0528298502982,965.1245559314706,967.196282012643,969.2680080938154,971.3397341749877,973.4114602561601,975.4831863373325,977.554912418505,979.6266384996773,981.6983645808497,983.7700906620221,980.2420372698706,982.313763351043,984.3854894322153,986.4572155133877,988.5289415945601,990.6006676757326,992.6723937569049,994.7441198380773,996.8158459192497,998.8875720004221,1000.9592980815944,1003.0310241627668,966.2099600957636,968.281686176936,970.3534122581084,972.4251383392807,974.4968644204531,976.5685905016255,978.6403165827979,980.7120426639704,982.7837687451427,984.8554948263151,986.9272209074875,988.9989469886599,991.0706730698322,993.1423991510046,995.214125232177,997.2858513133494,999.3575773945217,1001.4293034756942,720.092813216222,722.1645392973944,724.2362653785667,726.3079914597391,728.3797175409115,730.451443622084,732.5231697032563,734.5948957844287,736.6666218656011,738.7383479467735,740.8100740279459,742.8818001091182,744.9535261902906,747.025252271463,749.0969783526355,751.1687044338078,753.2404305149802,755.3121565961526,757.383882677325,759.4556087584974,761.5273348396697,763.5990609208421,791.3991180303101,793.4708441114825,795.5425701926548,797.6142962738272,799.6860223549996,801.757748436172,803.8294745173444,805.9012005985168,807.9729266796892,810.0446527608616,812.116378842034,814.1881049232063,683.1963081853443,685.2680342665167,687.3397603476891,689.4114864288614,691.4832125100338,693.5549385912062,695.6266646723786,697.6983907535509,699.7701168347234,701.8418429158958,703.9135689970682,705.9852950782406,708.0570211594129,710.1287472405853,712.2004733217577,714.2721994029301,716.3439254841024,718.4156515652749,864.2706622645156,866.342388345688,868.4141144268604,870.4858405080328,872.5575665892052,874.6292926703776,876.7010187515499,878.7727448327223,880.8444709138947,882.9161969950671,884.9879230762394,887.0596491574119,889.1313752385843,891.2031013197567,893.2748274009291,895.3465534821014,897.4182795632738,899.4900056444462,901.5617317256186,903.633457806791,905.7051838879634,907.7769099691358,911.2876811419683,913.3594072231407,915.431133304313,917.5028593854854,919.5745854666578,921.6463115478302,923.7180376290025,925.789763710175,927.8614897913474,929.9332158725198,932.0049419536922,934.0766680348645,883.4296945582771,885.5014206394495,887.5731467206219,889.6448728017943,891.7165988829667,893.7883249641391,895.8600510453115,897.9317771264839,900.0035032076562,902.0752292888286,904.146955370001,906.2186814511734,908.2904075323459,910.3621336135182,912.4338596946906,914.505585775863,916.5773118570354,918.6490379382077]\n",
       "},\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":900,\n",
       "\"height\":400\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"format\":\"%Y-%m-%d\",\n",
       "\"datetime\":true\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"y\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"blue\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"geom\":\"line\",\n",
       "\"mapping\":{\n",
       "\"x\":\"event_date\",\n",
       "\"y\":\"pred\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "},\n",
       "\"color\":\"magenta\",\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"Nk9VyV\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ],
      "text/plain": [
       "<lets_plot.plot.core.PlotSpec at 0x29e1879a610>"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot(df_daily7) \\\n",
    "+ geom_line(aes(x='event_date', y='y'), color='blue') \\\n",
    "+ geom_line(aes(x='event_date', y='pred'), color='magenta') \\\n",
    "+ scale_x_datetime(format='%Y-%m-%d') \\\n",
    "+ ggsize(900, 400)"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "结果表明增加总体趋势字段后，残差反而有少量增加，因此不增加总体趋势项。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<p style=\"color:blue; font-size:200%; font-weight:bold\">参考来源:</p>\n",
    "\n",
    "* [lets-plot.org](https://lets-plot.org/pages/api.html)\n",
    "* [statsmodels.org](https://www.statsmodels.org/v0.10.1/regression.html)\n",
    "* [Model basics](https://bookdown.org/ccolonescu/RPoE4/simplelm.html)\n",
    "* [Chapter 2 The Simple Linear Regression Model](https://r4ds.had.co.nz/model-basics.html#visualising-models)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py38_for_caret_and_echarts",
   "language": "python",
   "name": "py38_for_caret_and_echarts"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": true,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "409.6px"
   },
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
